diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-09-25 05:59:29 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-09-25 05:59:29 +0000 |
commit | 37b331a25b8bbc8ff4a11dace55d6fdf71c52d47 (patch) | |
tree | acd2ff90c630ce77b5cf436706d95ba18609e43f /usr.sbin/bind/lib | |
parent | cbeb1f8e870a309147bbec4fd18ad2e9e983562d (diff) |
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')
-rw-r--r-- | usr.sbin/bind/lib/isc/unix/fsaccess.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/usr.sbin/bind/lib/isc/unix/fsaccess.c b/usr.sbin/bind/lib/isc/unix/fsaccess.c index aac7c535198..24f8e2b3227 100644 --- a/usr.sbin/bind/lib/isc/unix/fsaccess.c +++ b/usr.sbin/bind/lib/isc/unix/fsaccess.c @@ -1,21 +1,21 @@ /* + * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. */ -/* $ISC: fsaccess.c,v 1.6 2001/01/09 21:58:18 bwelling Exp $ */ +/* $ISC: fsaccess.c,v 1.6.206.1 2004/03/06 08:14:59 marka Exp $ */ #include <sys/types.h> #include <sys/stat.h> @@ -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); |