diff --git a/mountpoint.c b/mountpoint.c index 4084fc1..15f0d47 100644 --- a/mountpoint.c +++ b/mountpoint.c @@ -1,4 +1,7 @@ /* See LICENSE file for copyright and license details. */ +#include +#include +#include #include #include #include @@ -19,6 +22,7 @@ main(int argc, char *argv[]) struct mntinfo *minfo = NULL; int siz; int ret = 0; + struct stat st; ARGBEGIN { case 'q': @@ -31,6 +35,12 @@ main(int argc, char *argv[]) if (argc < 1) usage(); + if (stat(argv[0], &st) < 0) + eprintf("stat %s:", argv[0]); + + if (!S_ISDIR(st.st_mode)) + eprintf("lstat %s: not a directory\n", argv[0]); + siz = grabmntinfo(&minfo); if (!siz) eprintf("grabmntinfo:");