jim@haring.UUCP (Jim McKie) (12/20/83)
The following is a bug report on a botch in the remote magtape protocol described in RMT(8). I found this when writing a set of routines (topen, tread, twrite, etc.) for a program to let us do remote tape-to-tape copies. Jim McKie Centrum voor Wiskunde en Informatica ..mcvax!jim --------------------------------------------------------------------------- Subject: /etc/rmt protocol botch Index: /usr/src/etc/rmt.c 4.2BSD Description: The remote magtape protocol described in RMT(8) is not followed by the module "/etc/rmt" with respect to the 'S' command. Repeat-By: Write a short program which creates a connection to the /etc/rmt on another machine then try an 'S' command - you will not get a valid response back (i.e. 'A') if the operation was successfull. /etc/rmt will send back the contents of a successfull MTIOCGET ioctl BEFORE it sends back the 'A' response. Fix: Change the two lines in the code for the 'S' command from (void) write(1, (char *)&mtget, sizeof (mtget)); goto respond; to (void) sprintf(resp, "A%d\n", rval); (void) write(1, resp, strlen(resp)); (void) write(1, (char *)&mtget, sizeof (mtget)); goto top; Another (fairly benign) bug is that all arrays declared of size 'SSIZE' should be of size 'SSIZE+1', to deal with one of the terminating conditions of the 'for' loop in the function 'gets'.