Subject: bin/27066: eject(1) does not DTRT for floppy drives (such as one in SPARCstation 5)
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <svs+pr@grep.ru>
List: netbsd-bugs
Date: 09/28/2004 23:19:25
>Number:         27066
>Category:       bin
>Synopsis:       eject(1) does not DTRT for floppy drives (such as one in SPARCstation 5)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 28 19:20:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Sergey Svishchev
>Release:        NetBSD 1.6.2
>Organization:
>Environment:
>Description:
eject(1) appends raw partition letter to device name, which, for fd(4), is
an indication to select non-default density.
>How-To-Repeat:
	
>Fix:
--- usr.bin/eject/eject.c	21 Apr 2004 01:05:47 -0000	1.18
+++ usr.bin/eject/eject.c	25 Apr 2004 18:48:49 -0000
@@ -74,11 +74,12 @@
 	/* OR one of the above with one of the below: */
 #define NOTLOADABLE 0x00
 #define LOADABLE 0x01
+#define FLOPPY 0x2
 #define TYPEMASK ((int)~0x01)
 }           nicknames[] = {
-	{ "diskette", "fd", DISK | NOTLOADABLE },
-	{ "floppy", "fd", DISK | NOTLOADABLE },
-	{ "fd", "fd", DISK | NOTLOADABLE },
+	{ "diskette", "fd", DISK | FLOPPY | NOTLOADABLE },
+	{ "floppy", "fd", DISK | FLOPPY | NOTLOADABLE },
+	{ "fd", "fd", DISK | FLOPPY | NOTLOADABLE },
 	{ "sd", "sd", DISK | NOTLOADABLE },
 	{ "cdrom", "cd", DISK | LOADABLE },
 	{ "cd", "cd", DISK | LOADABLE },
@@ -311,7 +312,8 @@
 			    devnum);
 			if ((nicknames[n].type & TYPEMASK) != TAPE) {
 				strcat(devname, "a");
-				devname[strlen(devname) - 1] += getrawpartition();
+				if ((nicknames[n].type & FLOPPY) != FLOPPY)
+					devname[strlen(devname) - 1] += getrawpartition();
 			}
 			return (devname);
 		}
>Release-Note:
>Audit-Trail:
>Unformatted: