summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/grep/mmfile.c4
-rw-r--r--usr.bin/mg/fileio.c4
-rw-r--r--usr.bin/pkill/pkill.c6
-rw-r--r--usr.bin/rcs/rcsutil.c4
-rw-r--r--usr.bin/sdiff/sdiff.c4
-rw-r--r--usr.bin/ssh/sftp.c6
6 files changed, 14 insertions, 14 deletions
diff --git a/usr.bin/grep/mmfile.c b/usr.bin/grep/mmfile.c
index c0996ade624..2c55d24b81c 100644
--- a/usr.bin/grep/mmfile.c
+++ b/usr.bin/grep/mmfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mmfile.c,v 1.10 2006/02/09 09:54:47 otto Exp $ */
+/* $OpenBSD: mmfile.c,v 1.11 2006/09/19 05:52:23 otto Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
@@ -55,7 +55,7 @@ mmopen(char *fn, char *mode)
goto ouch2;
if (st.st_size > SIZE_T_MAX) /* too big to mmap */
goto ouch2;
- if ((st.st_mode & S_IFREG) == 0) /* only mmap regular files */
+ if (!S_ISDIR(st.st_mode)) /* only mmap regular files */
goto ouch2;
mmf->len = (size_t)st.st_size;
mmf->base = mmap(NULL, mmf->len, PROT_READ, MAP_PRIVATE, mmf->fd, (off_t)0);
diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c
index 5d8583abaaf..2ad4967f8da 100644
--- a/usr.bin/mg/fileio.c
+++ b/usr.bin/mg/fileio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fileio.c,v 1.77 2006/07/25 08:22:32 kjell Exp $ */
+/* $OpenBSD: fileio.c,v 1.78 2006/09/19 05:52:23 otto Exp $ */
/* This file is in the public domain. */
@@ -518,7 +518,7 @@ make_file_list(char *buf)
continue;
if (stat(statname, &statbuf) < 0)
continue;
- if (statbuf.st_mode & S_IFDIR)
+ if (S_ISDIR(statbuf.st_mode))
isdir = 1;
}
diff --git a/usr.bin/pkill/pkill.c b/usr.bin/pkill/pkill.c
index 4e82a73a6ed..02848d7b64f 100644
--- a/usr.bin/pkill/pkill.c
+++ b/usr.bin/pkill/pkill.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pkill.c,v 1.14 2005/07/16 11:48:46 jmc Exp $ */
+/* $OpenBSD: pkill.c,v 1.15 2006/09/19 05:52:23 otto Exp $ */
/* $NetBSD: pkill.c,v 1.5 2002/10/27 11:49:34 kleink Exp $ */
/*-
@@ -38,7 +38,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: pkill.c,v 1.14 2005/07/16 11:48:46 jmc Exp $";
+static const char rcsid[] = "$OpenBSD: pkill.c,v 1.15 2006/09/19 05:52:23 otto Exp $";
#endif /* !lint */
#include <sys/types.h>
@@ -537,7 +537,7 @@ makelist(struct listhead *head, enum listtype type, char *src)
err(STATUS_ERROR, "stat(%s)", sp);
}
- if ((st.st_mode & S_IFCHR) == 0)
+ if (!S_ISCHR(st.st_mode))
errx(STATUS_BADUSAGE, "not a tty: `%s'", sp);
li->li_number = st.st_rdev;
diff --git a/usr.bin/rcs/rcsutil.c b/usr.bin/rcs/rcsutil.c
index 6c25e21acd2..43a594f1562 100644
--- a/usr.bin/rcs/rcsutil.c
+++ b/usr.bin/rcs/rcsutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsutil.c,v 1.18 2006/08/16 07:39:15 ray Exp $ */
+/* $OpenBSD: rcsutil.c,v 1.19 2006/09/19 05:52:23 otto Exp $ */
/*
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -171,7 +171,7 @@ rcs_choosefile(const char *filename, char *out, size_t len)
strlcat(rcsdir, RCSDIR, sizeof(rcsdir)) >= sizeof(rcsdir))
errx(1, "rcs_choosefile: truncation");
- if (stat(rcsdir, &sb) == 0 && (sb.st_mode & S_IFDIR))
+ if (stat(rcsdir, &sb) == 0 && S_ISDIR(sb.st_mode))
if (strlcpy(rcspath, rcsdir, sizeof(rcspath))
>= sizeof(rcspath) ||
strlcat(rcspath, "/", sizeof(rcspath)) >= sizeof(rcspath))
diff --git a/usr.bin/sdiff/sdiff.c b/usr.bin/sdiff/sdiff.c
index a46394be6b4..991c2d65b8c 100644
--- a/usr.bin/sdiff/sdiff.c
+++ b/usr.bin/sdiff/sdiff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdiff.c,v 1.19 2006/05/25 03:20:32 ray Exp $ */
+/* $OpenBSD: sdiff.c,v 1.20 2006/09/19 05:52:23 otto Exp $ */
/*
* Written by Raymond Lai <ray@cyth.net>.
@@ -108,7 +108,7 @@ mktmpcpy(const char *source_file)
err(2, "error getting file status from %s", source_file);
/* Regular file. */
- if (sb.st_mode & S_IFREG)
+ if (S_ISREG(sb.st_mode))
return (NULL);
} else {
/* If ``-'' does not exist the user meant stdin. */
diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c
index f033aff17e6..30358e199c2 100644
--- a/usr.bin/ssh/sftp.c
+++ b/usr.bin/ssh/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.91 2006/08/03 03:34:42 deraadt Exp $ */
+/* $OpenBSD: sftp.c,v 1.92 2006/09/19 05:52:23 otto Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -481,7 +481,7 @@ is_dir(char *path)
if (stat(path, &sb) == -1)
return(0);
- return(sb.st_mode & S_IFDIR);
+ return(S_ISDIR(sb.st_mode));
}
static int
@@ -505,7 +505,7 @@ remote_is_dir(struct sftp_conn *conn, char *path)
return(0);
if (!(a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS))
return(0);
- return(a->perm & S_IFDIR);
+ return(S_ISDIR(a->perm));
}
static int