summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/bind/bin/named/unix/os.c2
-rw-r--r--usr.sbin/bind/bin/rndc/unix/os.c20
-rw-r--r--usr.sbin/bind/lib/isc/unix/fsaccess.c22
-rw-r--r--usr.sbin/ppp/ppp/ether.c4
-rw-r--r--usr.sbin/ppp/ppp/server.c4
-rw-r--r--usr.sbin/ppp/ppp/tcp.c4
-rw-r--r--usr.sbin/ppp/ppp/udp.c4
-rw-r--r--usr.sbin/ypserv/yppush/yppush.c7
-rw-r--r--usr.sbin/ypserv/ypserv/ypserv_proc.c15
-rw-r--r--usr.sbin/ypserv/ypxfr/ypxfr.c7
10 files changed, 43 insertions, 46 deletions
diff --git a/usr.sbin/bind/bin/named/unix/os.c b/usr.sbin/bind/bin/named/unix/os.c
index cb719d5fac7..1755ee6be08 100644
--- a/usr.sbin/bind/bin/named/unix/os.c
+++ b/usr.sbin/bind/bin/named/unix/os.c
@@ -525,7 +525,7 @@ safe_open(const char *filename, isc_boolean_t append) {
if (stat(filename, &sb) == -1) {
if (errno != ENOENT)
return (-1);
- } else if ((sb.st_mode & S_IFREG) == 0) {
+ } else if (!S_ISREG(sb.st_mode)) {
errno = EOPNOTSUPP;
return (-1);
}
diff --git a/usr.sbin/bind/bin/rndc/unix/os.c b/usr.sbin/bind/bin/rndc/unix/os.c
index 0251d9e5e45..d89603dead8 100644
--- a/usr.sbin/bind/bin/rndc/unix/os.c
+++ b/usr.sbin/bind/bin/rndc/unix/os.c
@@ -1,21 +1,21 @@
/*
+ * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 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: os.c,v 1.5 2001/08/08 23:27:03 gson Exp $ */
+/* $ISC: os.c,v 1.5.206.1 2004/03/06 10:21:33 marka Exp $ */
#include <config.h>
@@ -52,7 +52,7 @@ safe_create(const char *filename) {
if (errno != ENOENT)
return (NULL);
flags = O_WRONLY | O_CREAT | O_EXCL;
- } else if ((sb.st_mode & S_IFREG) == 0) {
+ } else if (!S_ISREG(sb.st_mode)) {
errno = EOPNOTSUPP;
return (NULL);
} else
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);
diff --git a/usr.sbin/ppp/ppp/ether.c b/usr.sbin/ppp/ppp/ether.c
index 23b56ef603d..647e7573b42 100644
--- a/usr.sbin/ppp/ppp/ether.c
+++ b/usr.sbin/ppp/ppp/ether.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: ether.c,v 1.19 2003/10/20 03:15:38 deraadt Exp $
+ * $OpenBSD: ether.c,v 1.20 2006/09/25 05:59:28 otto Exp $
*/
#include <sys/param.h>
@@ -667,7 +667,7 @@ ether_Create(struct physical *p)
/* See if we're a netgraph socket */
struct stat st;
- if (fstat(p->fd, &st) != -1 && (st.st_mode & S_IFSOCK)) {
+ if (fstat(p->fd, &st) != -1 && S_ISSOCK(st.st_mode)) {
struct sockaddr_storage ssock;
struct sockaddr *sock = (struct sockaddr *)&ssock;
int sz;
diff --git a/usr.sbin/ppp/ppp/server.c b/usr.sbin/ppp/ppp/server.c
index a78478a106f..38705261ba3 100644
--- a/usr.sbin/ppp/ppp/server.c
+++ b/usr.sbin/ppp/ppp/server.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: server.c,v 1.17 2005/07/17 19:13:25 brad Exp $
+ * $OpenBSD: server.c,v 1.18 2006/09/25 05:59:28 otto Exp $
*/
#include <sys/param.h>
@@ -224,7 +224,7 @@ server_Reopen(struct bundle *bundle)
mask = server.cfg.mask;
server_Close(bundle);
if (server.cfg.sockname[0] != '\0' && stat(server.cfg.sockname, &st) == 0)
- if (!(st.st_mode & S_IFSOCK) || unlink(server.cfg.sockname) != 0)
+ if (!S_ISSOCK(st.st_mode) || unlink(server.cfg.sockname) != 0)
return SERVER_FAILED;
ret = server_LocalOpen(bundle, name, mask);
} else if (server.cfg.port != 0) {
diff --git a/usr.sbin/ppp/ppp/tcp.c b/usr.sbin/ppp/ppp/tcp.c
index 715af52434f..1511a4ffdd4 100644
--- a/usr.sbin/ppp/ppp/tcp.c
+++ b/usr.sbin/ppp/ppp/tcp.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: tcp.c,v 1.16 2002/07/18 18:52:36 brian Exp $
+ * $OpenBSD: tcp.c,v 1.17 2006/09/25 05:59:28 otto Exp $
*/
#include <sys/types.h>
@@ -169,7 +169,7 @@ tcp_Create(struct physical *p)
/* See if we're a tcp socket */
struct stat st;
- if (fstat(p->fd, &st) != -1 && (st.st_mode & S_IFSOCK)) {
+ if (fstat(p->fd, &st) != -1 && S_ISSOCK(st.st_mode)) {
int type, sz;
sz = sizeof type;
diff --git a/usr.sbin/ppp/ppp/udp.c b/usr.sbin/ppp/ppp/udp.c
index 0154688f48a..9372b1ccc49 100644
--- a/usr.sbin/ppp/ppp/udp.c
+++ b/usr.sbin/ppp/ppp/udp.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: udp.c,v 1.17 2003/10/20 03:15:38 deraadt Exp $
+ * $OpenBSD: udp.c,v 1.18 2006/09/25 05:59:28 otto Exp $
*/
#include <sys/types.h>
@@ -284,7 +284,7 @@ udp_Create(struct physical *p)
/* See if we're a connected udp socket */
struct stat st;
- if (fstat(p->fd, &st) != -1 && (st.st_mode & S_IFSOCK)) {
+ if (fstat(p->fd, &st) != -1 && S_ISSOCK(st.st_mode)) {
int type, sz;
sz = sizeof type;
diff --git a/usr.sbin/ypserv/yppush/yppush.c b/usr.sbin/ypserv/yppush/yppush.c
index 05bf1ba26c5..aa07a2d6d8d 100644
--- a/usr.sbin/ypserv/yppush/yppush.c
+++ b/usr.sbin/ypserv/yppush/yppush.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: yppush.c,v 1.24 2006/04/03 05:01:23 deraadt Exp $ */
+/* $OpenBSD: yppush.c,v 1.25 2006/09/25 05:59:28 otto Exp $ */
/*
* Copyright (c) 1995 Mats O Jansson <moj@stacken.kth.se>
@@ -27,7 +27,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: yppush.c,v 1.24 2006/04/03 05:01:23 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: yppush.c,v 1.25 2006/09/25 05:59:28 otto Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -262,8 +262,7 @@ main(int argc, char *argv[])
/* Check domain */
snprintf(map_path, sizeof map_path, "%s/%s", YP_DB_PATH, domain);
- if (!((stat(map_path, &finfo) == 0) &&
- ((finfo.st_mode & S_IFMT) == S_IFDIR))) {
+ if (!((stat(map_path, &finfo) == 0) && S_ISDIR(finfo.st_mode))) {
fprintf(stderr, "yppush: Map does not exist.\n");
exit(1);
}
diff --git a/usr.sbin/ypserv/ypserv/ypserv_proc.c b/usr.sbin/ypserv/ypserv/ypserv_proc.c
index 823a970b411..aa5c0cad51d 100644
--- a/usr.sbin/ypserv/ypserv/ypserv_proc.c
+++ b/usr.sbin/ypserv/ypserv/ypserv_proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ypserv_proc.c,v 1.25 2006/04/03 05:01:24 deraadt Exp $ */
+/* $OpenBSD: ypserv_proc.c,v 1.26 2006/09/25 05:59:28 otto Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
@@ -27,7 +27,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: ypserv_proc.c,v 1.25 2006/04/03 05:01:24 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: ypserv_proc.c,v 1.26 2006/09/25 05:59:28 otto Exp $";
#endif
#include <rpc/rpc.h>
@@ -94,7 +94,7 @@ ypproc_domain_2_svc(domainname *argp, struct svc_req *rqstp)
goto bail;
snprintf(domain_path, sizeof(domain_path), "%s/%s", YP_DB_PATH, *argp);
result = (bool_t) ((stat(domain_path, &finfo) == 0) &&
- (finfo.st_mode & S_IFDIR));
+ S_ISDIR(finfo.st_mode));
YPLOG("domain_2: caller=[%s].%d, auth_ok=%s, domain=%s, served=%s",
inet_ntoa(caller->sin_addr), ntohs(caller->sin_port),
@@ -121,7 +121,7 @@ ypproc_domain_nonack_2_svc(domainname *argp, struct svc_req *rqstp)
goto bail;
snprintf(domain_path, sizeof(domain_path), "%s/%s", YP_DB_PATH, *argp);
result = (bool_t) ((stat(domain_path, &finfo) == 0) &&
- (finfo.st_mode & S_IFDIR));
+ S_ISDIR(finfo.st_mode));
YPLOG("domain_nonack_2: caller=[%s].%d, auth_ok=%s, domain=%s, served=%s",
inet_ntoa(caller->sin_addr), ntohs(caller->sin_port), TORF(ok),
@@ -471,8 +471,7 @@ bail:
status = YP_TRUE;
res.maps = NULL;
- if (!((stat(domain_path, &finfo) == 0) &&
- ((finfo.st_mode & S_IFMT) == S_IFDIR)))
+ if (!((stat(domain_path, &finfo) == 0) && S_ISDIR(finfo.st_mode)))
status = YP_NODOM;
if (status >= 0) {
@@ -550,7 +549,7 @@ ypoldproc_domain_1_svc(domainname *argp, struct svc_req *rqstp)
goto bail;
snprintf(domain_path, sizeof(domain_path), "%s/%s", YP_DB_PATH, *argp);
result = (bool_t) ((stat(domain_path, &finfo) == 0) &&
- (finfo.st_mode & S_IFDIR));
+ S_ISDIR(finfo.st_mode));
YPLOG("domain_1: caller=[%s].%d, auth_ok=%s, domain=%s, served=%s",
inet_ntoa(caller->sin_addr), ntohs(caller->sin_port),
@@ -578,7 +577,7 @@ ypoldproc_domain_nonack_1_svc(domainname *argp, struct svc_req *rqstp)
goto bail;
snprintf(domain_path, sizeof(domain_path), "%s/%s", YP_DB_PATH, *argp);
result = (bool_t) ((stat(domain_path, &finfo) == 0) &&
- (finfo.st_mode & S_IFDIR));
+ S_ISDIR(finfo.st_mode));
YPLOG(
"domain_nonack_1: caller=[%s].%d, auth_ok=%s, domain=%s, served=%s",
diff --git a/usr.sbin/ypserv/ypxfr/ypxfr.c b/usr.sbin/ypserv/ypxfr/ypxfr.c
index 800211cbb70..f4156d9c3f1 100644
--- a/usr.sbin/ypserv/ypxfr/ypxfr.c
+++ b/usr.sbin/ypserv/ypxfr/ypxfr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ypxfr.c,v 1.34 2006/04/03 05:01:24 deraadt Exp $ */
+/* $OpenBSD: ypxfr.c,v 1.35 2006/09/25 05:59:28 otto Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
@@ -27,7 +27,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: ypxfr.c,v 1.34 2006/04/03 05:01:24 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: ypxfr.c,v 1.35 2006/09/25 05:59:28 otto Exp $";
#endif
#include <sys/types.h>
@@ -93,8 +93,7 @@ get_local_ordernum(char *domain, char *map, u_int32_t *lordernum)
status = YPPUSH_SUCC;
snprintf(map_path, sizeof map_path, "%s/%s", YP_DB_PATH, domain);
- if (!((stat(map_path, &finfo) == 0) &&
- ((finfo.st_mode & S_IFMT) == S_IFDIR))) {
+ if (!((stat(map_path, &finfo) == 0) && S_ISDIR(finfo.st_mode))) {
fprintf(stderr, "ypxfr: domain %s not found locally\n",
domain);
status = YPPUSH_NODOM;