From 2bcd7d59789e29c0979e4586e27c91231e0d98b0 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Tue, 19 Sep 2006 05:52:24 +0000 Subject: Use S_IS* macros insted of masking with S_IF* flags. The latter may have multiple bits set, which lead to surprising results. Spotted by Paul Stoeber, more to come. ok millert@ pedro@ jaredy@ djm@ --- usr.bin/pkill/pkill.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.bin/pkill') 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 @@ -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; -- cgit v1.2.3