X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=blobdiff_plain;f=rmt%2Frmt.c;h=b8cd3f6b0ca802246ae4a29cf8727f73a0eb1ac6;hp=74116b0a46e84f82a1a96ce321d5d766caf8a030;hb=b45f51d61e911ac8a040bef1efda6afd82261e03;hpb=1227625a12a66e0ded78a1997c2d23f23202a382 diff --git a/rmt/rmt.c b/rmt/rmt.c index 74116b0..b8cd3f6 100644 --- a/rmt/rmt.c +++ b/rmt/rmt.c @@ -1,7 +1,8 @@ /* * Ported to Linux's Second Extended File System as part of the * dump and restore backup suit - * Remy Card , 1994, 1995, 1996 + * Remy Card , 1994-1997 + * Stelian Pop , 1999 * */ @@ -39,13 +40,17 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1983, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint +#if 0 static char sccsid[] = "@(#)rmt.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id: rmt.c,v 1.2 1999/10/11 12:53:25 stelian Exp $"; #endif /* not lint */ /* @@ -111,7 +116,12 @@ top: getstring(device); getstring(mode); DEBUG2("rmtd: O %s %s\n", device, mode); - tape = open(device, atoi(mode)); + /* + * 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(mode), 0666); if (tape < 0) goto ioerror; goto respond; @@ -188,6 +198,12 @@ top: goto top; } + case 'V': /* version */ + getstring(op); + DEBUG1("rmtd: V %s\n", op); + rval = 2; + goto respond; + default: DEBUG1("rmtd: garbage command %c\n", c); exit(3); @@ -246,6 +262,6 @@ error(num) { DEBUG2("rmtd: E %d (%s)\n", num, strerror(num)); - (void)sprintf(resp, "E%d\n%s\n", num, strerror(num)); + (void)snprintf(resp, sizeof(resp), "E%d\n%s\n", num, strerror(num)); (void)write(1, resp, strlen(resp)); }