From b8f532c5b78512d5ca68382f3a322d28331c79aa Mon Sep 17 00:00:00 2001 From: Jaakko Heinonen Date: Fri, 20 Jan 2012 07:29:29 +0000 Subject: [PATCH] - Clean up checkpath(). - Remove unneeded sysexits.h include. No functional change. Submitted by: bde --- sbin/mount/getmntopts.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sbin/mount/getmntopts.c b/sbin/mount/getmntopts.c index 350306062632..f8a34530c5dc 100644 --- a/sbin/mount/getmntopts.c +++ b/sbin/mount/getmntopts.c @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include "mntopts.h" @@ -129,14 +128,12 @@ checkpath(const char *path, char *resolved) { struct stat sb; - if (realpath(path, resolved) != NULL && stat(resolved, &sb) == 0) { - if (!S_ISDIR(sb.st_mode)) { - errno = ENOTDIR; - return (1); - } - } else + if (realpath(path, resolved) == NULL || stat(resolved, &sb) != 0) return (1); - + if (!S_ISDIR(sb.st_mode)) { + errno = ENOTDIR; + return (1); + } return (0); }