X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=rmt%2Frmt.c;h=fc6eb827f4788c0c60b878f918c1eb0fc0e394b8;hb=51c11d00ad6213e3d00e484eff39d3fc734afa8e;hp=3c8f5fd3dd3ab17f90af0d6ea5738b6d5106fa27;hpb=1fe6adbfb31c8fcdb9fbf6f9b266970b626a9789;p=dump.git diff --git a/rmt/rmt.c b/rmt/rmt.c index 3c8f5fd..fc6eb82 100644 --- a/rmt/rmt.c +++ b/rmt/rmt.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: rmt.c,v 1.19 2002/04/16 21:00:59 stelian Exp $"; + "$Id: rmt.c,v 1.21 2002/07/29 12:00:34 stelian Exp $"; #endif /* not linux */ /* @@ -49,6 +49,7 @@ static const char rcsid[] = */ #include #include +#include #include #include #include @@ -123,7 +124,7 @@ main(int argc, char *argv[]) { int rval = 0; char c; - int n, i, cc; + int n, i, cc, oflags; unsigned long block = 0; argc--, argv++; @@ -146,12 +147,24 @@ top: getstring(device); getstring(filemode); DEBUG2("rmtd: O %s %s\n", device, filemode); + /* + * Translate extended GNU syntax into its numeric platform equivalent + */ + oflags = rmtflags_toint(filemode); +#ifdef O_TEXT + /* + * Default to O_BINARY the client may not know that we need it. + */ + if ((oflags & O_TEXT) == 0) + oflags |= O_BINARY; +#endif + DEBUG2("rmtd: O %s %d\n", device, oflags); /* * XXX the rmt protocol does not provide a means to * specify the permission bits; allow rw for everyone, * as modified by the users umask */ - tape = OPEN(device, atoi(filemode), 0666); + tape = OPEN(device, oflags, 0666); if (tape < 0) goto ioerror; block = 0;