summaryrefslogtreecommitdiffstats
path: root/sys-utils/eject.c
diff options
context:
space:
mode:
authorKarel Zak2012-06-13 13:55:49 +0200
committerKarel Zak2012-06-13 13:55:49 +0200
commit8388bbb3dfae6ebb9d614012e7484ffb12de07a3 (patch)
tree0d2769c1c66d9364588e218881ae583e52c18f29 /sys-utils/eject.c
parenteject: add --no-partitions-unmount (diff)
downloadkernel-qcow2-util-linux-8388bbb3dfae6ebb9d614012e7484ffb12de07a3.tar.gz
kernel-qcow2-util-linux-8388bbb3dfae6ebb9d614012e7484ffb12de07a3.tar.xz
kernel-qcow2-util-linux-8388bbb3dfae6ebb9d614012e7484ffb12de07a3.zip
eject: don't try to use non-device path
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/eject.c')
-rw-r--r--sys-utils/eject.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys-utils/eject.c b/sys-utils/eject.c
index 240e27e74..402152204 100644
--- a/sys-utils/eject.c
+++ b/sys-utils/eject.c
@@ -983,8 +983,15 @@ int main(int argc, char **argv)
free(device);
device = disk;
disk = NULL;
- } else
+ } else {
+ struct stat st;
+
+ if (stat(device, &st) != 0 || !S_ISBLK(st.st_mode))
+ errx(EXIT_FAILURE, _("%s: not found mountpoint or device "
+ "with the given name"), device);
+
verbose(_("%s: is whole-disk device"), device);
+ }
if (F_option == 0 && is_hotpluggable(device) == 0)
errx(EXIT_FAILURE, _("%s: is not hot-pluggable device"), device);