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;
{
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;
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"));
}
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)