diff options
author | Karel Zak | 2012-05-18 12:01:10 +0200 |
---|---|---|
committer | Karel Zak | 2012-05-18 12:01:10 +0200 |
commit | 28094b1e3c4b16d8a16dc78043b8887fdc99bd8a (patch) | |
tree | 7882b535f3693a23236ea1cf7ab4798e9501741e /sys-utils | |
parent | libmount: don't canonicalize target (diff) | |
download | kernel-qcow2-util-linux-28094b1e3c4b16d8a16dc78043b8887fdc99bd8a.tar.gz kernel-qcow2-util-linux-28094b1e3c4b16d8a16dc78043b8887fdc99bd8a.tar.xz kernel-qcow2-util-linux-28094b1e3c4b16d8a16dc78043b8887fdc99bd8a.zip |
eject: allow to address device by LABEL/UUID
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils')
-rw-r--r-- | sys-utils/eject.1 | 4 | ||||
-rw-r--r-- | sys-utils/eject.c | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/sys-utils/eject.1 b/sys-utils/eject.1 index c3333fa0a..5d7cfa0a9 100644 --- a/sys-utils/eject.1 +++ b/sys-utils/eject.1 @@ -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 diff --git a/sys-utils/eject.c b/sys-utils/eject.c index e008886cf..4f3fb831f 100644 --- a/sys-utils/eject.c +++ b/sys-utils/eject.c @@ -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); } |