summaryrefslogtreecommitdiffstats
path: root/sbin/mount/getmntopts.c
diff options
context:
space:
mode:
authorjh <jh@FreeBSD.org>2012-01-16 19:34:21 +0000
committerjh <jh@FreeBSD.org>2012-01-16 19:34:21 +0000
commitae73284c1a1116d89c84235929df10421a348b30 (patch)
tree54d0a2f2ed01c217587bf7b24aec11a7fbcadd97 /sbin/mount/getmntopts.c
parent5a45f730a5625608124e818a7be2c3dbd2d20512 (diff)
downloadFreeBSD-src-ae73284c1a1116d89c84235929df10421a348b30.zip
FreeBSD-src-ae73284c1a1116d89c84235929df10421a348b30.tar.gz
Change checkpath() to not exit on error. This is a prerequisite for
fixing the mount(8) "failok" option. PR: 163668 Reviewed by: Garrett Cooper, delphij (previous version)
Diffstat (limited to 'sbin/mount/getmntopts.c')
-rw-r--r--sbin/mount/getmntopts.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sbin/mount/getmntopts.c b/sbin/mount/getmntopts.c
index 194b3df..3503060 100644
--- a/sbin/mount/getmntopts.c
+++ b/sbin/mount/getmntopts.c
@@ -124,16 +124,20 @@ rmslashes(char *rrpin, char *rrpout)
*rrpout = '\0';
}
-void
+int
checkpath(const char *path, char *resolved)
{
struct stat sb;
if (realpath(path, resolved) != NULL && stat(resolved, &sb) == 0) {
- if (!S_ISDIR(sb.st_mode))
- errx(EX_USAGE, "%s: not a directory", resolved);
+ if (!S_ISDIR(sb.st_mode)) {
+ errno = ENOTDIR;
+ return (1);
+ }
} else
- errx(EX_USAGE, "%s: %s", resolved, strerror(errno));
+ return (1);
+
+ return (0);
}
void
OpenPOWER on IntegriCloud