summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bind/lib/isc/unix/fsaccess.c
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2006-09-25 05:59:28 +0000
committerotto <otto@openbsd.org>2006-09-25 05:59:28 +0000
commit15a2cd27d2ab74b5e51133641398df2c14c7bab5 (patch)
tree34b946daa79981fc2500d869d3c833aab324ce5a /usr.sbin/bind/lib/isc/unix/fsaccess.c
parentChange "a SSH" to "an SSH". Hurray, I'm not the only one who (diff)
downloadwireguard-openbsd-15a2cd27d2ab74b5e51133641398df2c14c7bab5.tar.xz
wireguard-openbsd-15a2cd27d2ab74b5e51133641398df2c14c7bab5.zip
Use S_IS* macros insted of masking with S_IF* flags. The latter may
have multiple bits set, which leads to surprising results. Spotted by from Paul Stoeber, more to come. ok jaredy@
Diffstat (limited to 'usr.sbin/bind/lib/isc/unix/fsaccess.c')
-rw-r--r--usr.sbin/bind/lib/isc/unix/fsaccess.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/bind/lib/isc/unix/fsaccess.c b/usr.sbin/bind/lib/isc/unix/fsaccess.c
index 35b99eeb9b9..24f8e2b3227 100644
--- a/usr.sbin/bind/lib/isc/unix/fsaccess.c
+++ b/usr.sbin/bind/lib/isc/unix/fsaccess.c
@@ -40,9 +40,9 @@ isc_fsaccess_set(const char *path, isc_fsaccess_t access) {
if (stat(path, &statb) != 0)
return (isc__errno2result(errno));
- if ((statb.st_mode & S_IFDIR) != 0)
+ if (S_ISDIR(statb.st_mode))
is_dir = ISC_TRUE;
- else if ((statb.st_mode & S_IFREG) == 0)
+ else if (!S_ISREG(statb.st_mode))
return (ISC_R_INVALIDFILE);
result = check_bad_bits(access, is_dir);