X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=blobdiff_plain;f=common%2Fdumprmt.c;h=f89a13de1fb60a1c5cf5fdc14b0b3bdd12a85dee;hp=129ce208c4c26d8ce9e82b5ec5a89f2caa1d9d60;hb=ba3af39e8b08027d3338b5533bddc86a9c803a74;hpb=88ac410d747e12ed2c1edd1ed0fdab994de71cf9 diff --git a/common/dumprmt.c b/common/dumprmt.c index 129ce20..f89a13d 100644 --- a/common/dumprmt.c +++ b/common/dumprmt.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: dumprmt.c,v 1.21 2002/05/21 15:48:46 stelian Exp $"; + "$Id: dumprmt.c,v 1.23 2002/07/29 12:00:33 stelian Exp $"; #endif /* not lint */ #include @@ -49,6 +49,7 @@ static const char rcsid[] = #include #include #include +#include #ifdef __linux__ #include #ifdef HAVE_EXT2FS_EXT2_FS_H @@ -76,6 +77,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -132,7 +134,7 @@ rmthost(const char *host) } static void -rmtconnaborted(int signo) +rmtconnaborted(UNUSED(int signo)) { msg("Lost connection to remote host.\n"); if (errfd != -1) { @@ -273,11 +275,17 @@ okname(const char *cp0) } int -rmtopen(const char *tape, const char *mode) +rmtopen(const char *tape, const int mode) { char buf[MAXPATHLEN]; - - (void)snprintf(buf, sizeof (buf), "O%s\n%s\n", tape, mode); + char *rmtflags; + + rmtflags = rmtflags_tochar(mode); + (void)snprintf(buf, sizeof (buf), "O%s\n%d %s\n", + tape, + mode & O_ACCMODE, + rmtflags); + free(rmtflags); rmtstate = TS_OPEN; return (rmtcall(tape, buf)); } @@ -343,7 +351,7 @@ rmtstatus(void) if (rmtstate != TS_OPEN) return (NULL); rmtcall("status", "S\n"); - for (i = 0, cp = (char *)&mts; i < sizeof(mts); i++) + for (i = 0, cp = (char *)&mts; i < (int)sizeof(mts); i++) *cp++ = rmtgetb(); return (&mts); } @@ -363,7 +371,7 @@ static int rmtcall(const char *cmd, const char *buf) { - if (write(tormtape, buf, strlen(buf)) != strlen(buf)) + if (write(tormtape, buf, strlen(buf)) != (ssize_t)strlen(buf)) rmtconnaborted(0); return (rmtreply(cmd)); }