]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
eject: don't try to use non-device path
authorKarel Zak <kzak@redhat.com>
Wed, 13 Jun 2012 11:55:49 +0000 (13:55 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 13 Jun 2012 11:55:49 +0000 (13:55 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/eject.c

index 240e27e74bd225b2615887794502d5e9bd9570b6..402152204c758e68091466e709be89d740e80b77 100644 (file)
@@ -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);