diff options
author | delphij <delphij@FreeBSD.org> | 2017-04-03 06:13:05 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2017-04-03 06:13:05 +0000 |
commit | 8f3f0abee7d29f21741ec48bf8c0646268c4d3aa (patch) | |
tree | 608f77369fec0c5fd4add24243cb15d232592b5a /usr.bin/sed/main.c | |
parent | 1df8375dcfafacfdcf18d7379e2e30aa3a602428 (diff) | |
download | FreeBSD-src-8f3f0abee7d29f21741ec48bf8c0646268c4d3aa.zip FreeBSD-src-8f3f0abee7d29f21741ec48bf8c0646268c4d3aa.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/sed/main.c')
-rw-r--r-- | usr.bin/sed/main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c index 36a3299..2307205 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"); |