#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 */
/*
*/
#include <config.h>
#include <compatlfs.h>
+#include <rmtflags.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/mtio.h>
{
int rval = 0;
char c;
- int n, i, cc;
+ int n, i, cc, oflags;
unsigned long block = 0;
argc--, argv++;
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;