]> Dogcows Code - chaz/tar/blobdiff - src/rmt.c
(to_oct): New parameter substitute, giving a substitute value to use
[chaz/tar] / src / rmt.c
index d8aebba3e6b728675a2484dbdb743980e3aac439..ac0317d31bc1b01a93180a35b6d55f6cc121dece 100644 (file)
--- a/src/rmt.c
+++ b/src/rmt.c
@@ -227,34 +227,7 @@ top:
        if (tape >= 0)
          close (tape);
 
-#if defined (i386) && defined (AIX)
-
-       /* This is alleged to fix a byte ordering problem.  I'm quite
-          suspicious if it's right. -- mib.  */
-
-       {
-         mode_t old_mode = atol (mode_string);
-         mode_t new_mode = 0;
-
-         if ((old_mode & 3) == 0)
-           new_mode |= O_RDONLY;
-         if (old_mode & 1)
-           new_mode |= O_WRONLY;
-         if (old_mode & 2)
-           new_mode |= O_RDWR;
-         if (old_mode & 0x0008)
-           new_mode |= O_APPEND;
-         if (old_mode & 0x0200)
-           new_mode |= O_CREAT;
-         if (old_mode & 0x0400)
-           new_mode |= O_TRUNC;
-         if (old_mode & 0x0800)
-           new_mode |= O_EXCL;
-         tape = open (device_string, new_mode, 0666);
-       }
-#else
        tape = open (device_string, atoi (mode_string), 0666);
-#endif
        if (tape < 0)
          goto ioerror;
        goto respond;
@@ -392,12 +365,12 @@ top:
        {
          struct mtop mtop;
          const char *p;
-         daddr_t count = 0;
+         off_t count = 0;
          int negative;
 
          /* Parse count_string, taking care to check for overflow.
             We can't use standard functions,
-            since daddr_t might be longer than long.  */
+            since off_t might be longer than long.  */
          
          for (p = count_string;  *p == ' ' || *p == '\t';  p++)
            continue;
@@ -412,8 +385,8 @@ top:
                break;
              else
                {
-                 daddr_t c10 = 10 * count;
-                 daddr_t nc = negative ? c10 - digit : c10 + digit;
+                 off_t c10 = 10 * count;
+                 off_t nc = negative ? c10 - digit : c10 + digit;
                  if (c10 / 10 != count || (negative ? c10 < nc : nc < c10))
                    {
                      report_error_message (N_("Seek offset out of range"));
@@ -424,6 +397,11 @@ top:
            }
 
          mtop.mt_count = count;
+         if (mtop.mt_count != count)
+           {
+             report_error_message (N_("Seek offset out of range"));
+             exit (EXIT_FAILURE);
+           }
          mtop.mt_op = atoi (operation_string);
 
          if (ioctl (tape, MTIOCTOP, (char *) &mtop) < 0)
This page took 0.021067 seconds and 4 git commands to generate.