]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
eject: allow to address device by LABEL/UUID
authorKarel Zak <kzak@redhat.com>
Fri, 18 May 2012 10:01:10 +0000 (12:01 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 18 May 2012 10:01:10 +0000 (12:01 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/eject.1
sys-utils/eject.c

index c3333fa0a717dc57c6f51d0a7ededbf73b121abe..5d7cfa0a95db508f4c731455d658eb40b7abce87 100644 (file)
@@ -19,7 +19,9 @@ multi-disc CD-ROM changers, the auto-eject feature supported by some devices,
 and close the disc tray of some CD-ROM drives.
 .PP
 The device corresponding to \fIdevice\fP or \fImountpoint\fP is ejected.  If no
-name is specified, the default name /dev/cdrom is used.
+name is specified, the default name /dev/cdrom is used. The device may be
+addressed by device name (e.g. 'sda'), device path (e.g. '/dev/sda'),
+UUID=<uuid> or LABEL=<label> tags.
 .PP
 There are four different methods of ejecting, depending on whether the device
 is a CD-ROM, SCSI device, removable floppy, or tape.  By default eject tries
index e008886cfa476e694db66a648f25635b009d94bb..4f3fb831f8f086f0f3e1a94388f97602c789f551 100644 (file)
@@ -944,9 +944,12 @@ int main(int argc, char **argv)
 
                /* figure out full device or mount point name */
                p = find_device(device);
-               free(device);
+               if (p)
+                       free(device);
+               else
+                       p = device;
 
-               device = mnt_resolve_path(p, NULL);
+               device = mnt_resolve_spec(p, NULL);
                free(p);
        }