]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/vtape.c
Add mutex some priority info for SD
[bacula/bacula] / bacula / src / stored / vtape.c
index 99e9fdd13559ecea286e9503879702135d41f811..b8b9b4a50d4edb3377f92d75e932023afde1e54f 100644 (file)
@@ -433,7 +433,7 @@ vtape::vtape()
    current_file = 0;
    current_block = -1;
 
-   max_block = 2*1024*2048;      /* 2GB */
+   max_block = VTAPE_MAX_BLOCK;
 }
 
 vtape::~vtape()
@@ -611,7 +611,7 @@ int vtape::fsf()
 bool vtape::read_fm(VT_READ_FM_MODE read_all)
 {
    int ret;
-   uint32_t c;
+   uint32_t c = 0;
    if (read_all == VT_READ_EOF) {
       ::read(fd, &c, sizeof(c));
       if (c != 0) {
@@ -961,7 +961,9 @@ int vtape::open(const char *pathname, int uflags)
 
    /* If the vtape is empty, start by writing a EOF */
    if (online && !read_fm(VT_READ_EOF)) {
-      weof();
+      lseek(fd, 0, SEEK_SET);          /* rewind */
+      cur_FM = next_FM = last_FM = 0;  /* reset */
+      weof();                          /* write the first EOF */
       last_file = current_file=0;
    }