Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/rmt Fix rmt for use with Solaris 2.7 and others. Th...



details:   https://anonhg.NetBSD.org/src/rev/bc54dc1c4484
branches:  trunk
changeset: 481895:bc54dc1c4484
user:      mjacob <mjacob%NetBSD.org@localhost>
date:      Tue Feb 08 18:00:05 2000 +0000

description:
Fix rmt for use with Solaris 2.7 and others. The deal here is that for
version 0 RMT protocol, the query of status makes no sense (send back, in
binary, the mtget structure), but systems sometimes use it anyway. And when
they use it, they get upset if they get back something that is a different
size from what they expect. The original mtget structure in BSD 4.3 is
24 bytes in size, and that seems to be what they can cope with.

The correct fix would be to go to Version 1 RMT, but that's a horse of
another color...

diffstat:

 usr.sbin/rmt/rmt.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 5a3c1143ed79 -r bc54dc1c4484 usr.sbin/rmt/rmt.c
--- a/usr.sbin/rmt/rmt.c        Tue Feb 08 17:56:58 2000 +0000
+++ b/usr.sbin/rmt/rmt.c        Tue Feb 08 18:00:05 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rmt.c,v 1.9 1997/10/17 13:03:25 lukem Exp $    */
+/*     $NetBSD: rmt.c,v 1.10 2000/02/08 18:00:05 mjacob Exp $  */
 
 /*
  * Copyright (c) 1983, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)rmt.c      8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: rmt.c,v 1.9 1997/10/17 13:03:25 lukem Exp $");
+__RCSID("$NetBSD: rmt.c,v 1.10 2000/02/08 18:00:05 mjacob Exp $");
 #endif
 #endif /* not lint */
 
@@ -189,10 +189,12 @@
                        if (ioctl(tape, MTIOCGET, (char *)&mtget) < 0)
                                goto ioerror;
                        rval = sizeof (mtget);
+                       /* limit size to 'original' mtget size */
+                       if (rval > 24)
+                               rval = 24;
                        (void)sprintf(resp, "A%d\n", rval);
                        (void)write(STDOUT_FILENO, resp, strlen(resp));
-                       (void)write(STDOUT_FILENO, (char *)&mtget,
-                           sizeof (mtget));
+                       (void)write(STDOUT_FILENO, (char *)&mtget, rval);
                        goto top;
                }
 



Home | Main Index | Thread Index | Old Index