From 8388bbb3dfae6ebb9d614012e7484ffb12de07a3 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 13 Jun 2012 13:55:49 +0200 Subject: eject: don't try to use non-device path Signed-off-by: Karel Zak --- sys-utils/eject.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sys-utils/eject.c') 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); -- cgit v1.2.3-55-g7522