]> git.sur5r.net Git - bacula/bacula/commitdiff
Keep correct errno when FSF fails
authorKern Sibbald <kern@sibbald.com>
Tue, 8 May 2007 19:28:22 +0000 (19:28 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 8 May 2007 19:28:22 +0000 (19:28 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4732 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/stored/dev.c

index 34e7d225fead94586fc3dd5347d50b6e1601a17b..eb1cd41c977679378a619f1f7ce108aa4e0a9c32 100644 (file)
@@ -1294,10 +1294,15 @@ bool DEVICE::fsf(int num)
     *  forward space past the end of the medium.
     */
    if (has_cap(CAP_FSF) && has_cap(CAP_MTIOCGET) && has_cap(CAP_FASTFSF)) {
+      int errno_save;
       mt_com.mt_op = MTFSF;
       mt_com.mt_count = num;
       stat = tape_ioctl(m_fd, MTIOCTOP, (char *)&mt_com);
+      errno_save = errno;
       if (stat < 0 || (os_file=get_os_tape_file()) < 0) {
+         if (os_file >= 0) {             /* get_os_tape_file reset errno */
+            errno = errno_save;
+         }
          berrno be;
          set_eot();
          Dmsg0(200, "Set ST_EOT\n");