summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2017-04-03 06:14:23 +0000
committerdelphij <delphij@FreeBSD.org>2017-04-03 06:14:23 +0000
commitb2f1ffdae44432aaeb2a07a3c2b3161fbc273d15 (patch)
tree83f81e50ecb05af00249962fc4aadfa135e1430d /usr.bin
parentf7a39523d8991c6df3c441c980a954d3ba373e99 (diff)
downloadFreeBSD-src-b2f1ffdae44432aaeb2a07a3c2b3161fbc273d15.zip
FreeBSD-src-b2f1ffdae44432aaeb2a07a3c2b3161fbc273d15.tar.gz
MFC r312404, r312519, r313277:
Use S_ISREG instead of manual & (also it's better to compare the result from & and the pattern instead of just assuming it's one bit value). Pointed out by Tianjie Mao <tjmao tjmao com>.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/sed/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c
index f907dcd..7984dcc 100644
--- a/usr.bin/sed/main.c
+++ b/usr.bin/sed/main.c
@@ -391,7 +391,7 @@ mf_fgets(SPACE *sp, enum e_spflag spflag)
if (inplace != NULL) {
if (lstat(fname, &sb) != 0)
err(1, "%s", fname);
- if (!(sb.st_mode & S_IFREG))
+ if (!S_ISREG(sb.st_mode))
errx(1, "%s: %s %s", fname,
"in-place editing only",
"works for regular files");
OpenPOWER on IntegriCloud