#ifdef USE_FAKETAPE
#include "faketape.h"
-static int dbglevel = 1000;
+static int dbglevel = 10;
#define FILE_OFFSET 30
faketape *ftape_list[FTAPE_MAX_DRIVE];
return -1;
}
- Dmsg1(dbglevel, "write inplace=%i\n", inplace);
check_inplace();
if (!atEOD) { /* if not at the end of the data */
int orig_f = current_file;
int orig_b = current_block;
+ /* begin of tape, do nothing */
+ if (atBOT) {
+ errno = EIO;
+ return -1;
+ }
+
+ if (atEOF) {
+ if (!current_block) {
+ if (current_file > 0) {
+ current_file--;
+ }
+ current_block=-1;
+ errno = EIO;
+ return -1;
+
+ } else {
+ atEOF=false;
+ }
+ }
+
current_block=0;
seek_file();
}
Dmsg2(dbglevel, "bsr %i:%i\n", current_file, current_block);
+ errno=0;
atEOT = atEOF = atEOD = false;
+ atBOT = (current_block == 0 && current_file == 0);
+
+ current_block = -1;
return 0;
}
return -1;
} /* read ok */
- current_block++;
+ if (current_block >= 0) {
+ current_block++;
+ }
return nb;
}