From 900bffdb4fb7cf14ada66e3a0c81b1275cc7571f Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Wed, 12 Feb 2003 11:02:28 +0000 Subject: [PATCH] Fixed largefile seeks in rmt --- CHANGES | 6 +++++- common/dumprmt.c | 12 ++++++------ restore/tape.c | 5 +++-- rmt/rmt.c | 12 ++++++------ 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CHANGES b/CHANGES index e3b0004..659a36f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.215 2003/02/11 12:43:44 stelian Exp $ +$Id: CHANGES,v 1.216 2003/02/12 11:02:28 stelian Exp $ Changes between versions 0.4b33 and 0.4b34 (released ?????????????????) ======================================================================= @@ -20,6 +20,10 @@ Changes between versions 0.4b33 and 0.4b34 (released ?????????????????) even when using a remote tape. Thanks to Fabrice Bellet for reporting the bug. +5. Fixed (again) handling of long (largefile) seeks in rmt. + Thanks to Fabrice Bellet for reporting + the bug. + Changes between versions 0.4b32 and 0.4b33 (released February 10, 2003) ======================================================================= diff --git a/common/dumprmt.c b/common/dumprmt.c index 1d49a24..699122f 100644 --- a/common/dumprmt.c +++ b/common/dumprmt.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: dumprmt.c,v 1.24 2003/01/10 14:42:50 stelian Exp $"; + "$Id: dumprmt.c,v 1.25 2003/02/12 11:02:29 stelian Exp $"; #endif /* not lint */ #include @@ -104,12 +104,12 @@ int rshpid = -1; static const char *rmtpeer = 0; static int okname __P((const char *)); -static int rmtcall __P((const char *, const char *)); +static OFF_T rmtcall __P((const char *, const char *)); static void rmtconnaborted __P((int)); static int rmtgetb __P((void)); static int rmtgetconn __P((void)); static void rmtgets __P((char *, size_t)); -static int rmtreply __P((const char *)); +static OFF_T rmtreply __P((const char *)); static int piped_child __P((const char **command)); #ifdef KERBEROS int krcmd __P((char **, int /*u_short*/, char *, char *, int *, char *)); @@ -367,7 +367,7 @@ rmtioctl(int cmd, int count) return (rmtcall("ioctl", buf)); } -static int +static OFF_T rmtcall(const char *cmd, const char *buf) { @@ -376,7 +376,7 @@ rmtcall(const char *cmd, const char *buf) return (rmtreply(cmd)); } -static int +static OFF_T rmtreply(const char *cmd) { char *cp; @@ -401,7 +401,7 @@ rmtreply(const char *cmd) code); rmtconnaborted(0); } - return (atoi(code + 1)); + return (OFF_T)(atoll(code + 1)); } static int diff --git a/restore/tape.c b/restore/tape.c index 9bfb4c5..3db8f07 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -46,7 +46,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.69 2003/02/11 12:43:45 stelian Exp $"; + "$Id: tape.c,v 1.70 2003/02/12 11:02:30 stelian Exp $"; #endif /* not lint */ #include @@ -2085,7 +2085,8 @@ setmagtapein(void) { magtapein = ioctl(mt, MTIOCGET, (char *)&mt_stat) == 0; } - Vprintf(stdout,"Input is from %s\n", + Vprintf(stdout,"Input is from a %s %s\n", + host ? "remote" : "local", magtapein ? "tape" : Vflag ? "multi-volume (no tape)" : "file/pipe"); } diff --git a/rmt/rmt.c b/rmt/rmt.c index 3167e1d..7f93f57 100644 --- a/rmt/rmt.c +++ b/rmt/rmt.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: rmt.c,v 1.22 2003/01/10 14:42:51 stelian Exp $"; + "$Id: rmt.c,v 1.23 2003/02/12 11:02:31 stelian Exp $"; #endif /* not linux */ /* @@ -122,7 +122,7 @@ void getstring __P((char *)); int main(int argc, char *argv[]) { - int rval = 0; + OFF_T rval = 0; char c; int n, i, cc, oflags; unsigned long block = 0; @@ -214,7 +214,7 @@ top: rval = read(tape, record, n); if (rval < 0) goto ioerror; - (void)sprintf(resp, "A%d\n", rval); + (void)sprintf(resp, "A%lld\n", (long long)rval); (void)write(1, resp, strlen(resp)); (void)write(1, record, rval); block += n >> 10; @@ -347,7 +347,7 @@ top: if (ioctl(tape, MTIOCGET, (char *)&mtget) < 0) goto ioerror; rval = sizeof (mtget); - (void)sprintf(resp, "A%d\n", rval); + (void)sprintf(resp, "A%lld\n", (long long)rval); (void)write(1, resp, strlen(resp)); (void)write(1, (char *)&mtget, sizeof (mtget)); goto top; @@ -407,8 +407,8 @@ top: exit(3); } respond: - DEBUG1("rmtd: A %d\n", rval); - (void)sprintf(resp, "A%d\n", rval); + DEBUG1("rmtd: A %lld\n", (long long)rval); + (void)sprintf(resp, "A%lld\n", (long long)rval); (void)write(1, resp, strlen(resp)); goto top; ioerror: -- 2.39.5