svn commit: r312404 - head/usr.bin/sed
Xin LI
delphij at FreeBSD.org
Thu Jan 19 08:01:36 UTC 2017
Author: delphij
Date: Thu Jan 19 08:01:35 2017
New Revision: 312404
URL: https://svnweb.freebsd.org/changeset/base/312404
Log:
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>.
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D4827
Modified:
head/usr.bin/sed/main.c
Modified: head/usr.bin/sed/main.c
==============================================================================
--- head/usr.bin/sed/main.c Thu Jan 19 07:29:52 2017 (r312403)
+++ head/usr.bin/sed/main.c Thu Jan 19 08:01:35 2017 (r312404)
@@ -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");
More information about the svn-src-all
mailing list