X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Frmt.c;h=b0ec6f98c3f7a5fd2d91b62639d829081b066b3d;hb=6f1783ad432c0d2625d1232463987594414089fe;hp=bf2e0a128640a6fd5850104f331a85ad47c5ff22;hpb=6290150c47daea1d034f2293756b623169ad1b9b;p=chaz%2Ftar diff --git a/src/rmt.c b/src/rmt.c index bf2e0a1..b0ec6f9 100644 --- a/src/rmt.c +++ b/src/rmt.c @@ -254,6 +254,7 @@ top: char position_string[STRING_SIZE]; off_t count = 0; int negative; + int whence; char *p; get_string (count_string); @@ -288,7 +289,16 @@ top: } } - count = lseek (tape, count, atoi (position_string)); + switch (atoi (position_string)) + { + case 0: whence = SEEK_SET; break; + case 1: whence = SEEK_CUR; break; + case 2: whence = SEEK_END; break; + default: + report_error_message (N_("Seek direction out of range")); + exit (EXIT_FAILURE); + } + count = lseek (tape, count, whence); if (count < 0) goto ioerror;