Ripped from Fedora, updates from Ubuntu http://bugs.gentoo.org/91977 --- eject.1 +++ eject.1 @@ -34,8 +34,8 @@ The device corresponding to is ejected. The name can be a device file or mount point, either a full path or with the leading -"/dev" or "/mnt" omitted. If no name is specified, the default name -"cdrom" is used. +"/dev", "/media" or "/mnt" omitted. If no name is specified, the +default name "cdrom" is used. There are four different methods of ejecting, depending on whether the device is a CD-ROM, SCSI device, removable floppy, or tape. By default @@ -257,11 +257,11 @@ the name ends in a trailing slash, it is removed (this is to support filenames generated using shell file name completion). If the name starts with '.' or '/', it tries to open it as a device file or mount -point. If that fails, it tries prepending '/dev/', '/mnt/', '/dev/cdroms', -\&'/dev/rdsk/', '/dev/dsk/', and finally './' to the name, until a -device file or mount point is found that can be opened. The program -checks /etc/mtab for mounted devices. If that fails, it also checks -/etc/fstab for mount points of currently unmounted devices. +point. If that fails, it tries prepending '/dev/', '/media/', '/mnt/', +'/dev/cdroms', '/dev/rdsk/', '/dev/dsk/', and finally './' to the name, +until a device file or mount point is found that can be opened. The +program checks /etc/mtab for mounted devices. If that fails, it also +checks /etc/fstab for mount points of currently unmounted devices. Creating symbolic links such as /dev/cdrom or /dev/zip is recommended so that --- eject.c +++ eject.c @@ -294,6 +294,7 @@ * * foo (if foo starts with '.' or '/') * /dev/foo + * /media/foo * /mnt/foo * /dev/cdroms/foo * /dev/cdroms/foo0 @@ -321,6 +322,11 @@ if (FileExists(buf)) return buf; + strcpy(buf, "/media/"); + strcat(buf, name); + if (FileExists(buf)) + return buf; + strcpy(buf, "/mnt/"); strcat(buf, name); if (FileExists(buf))