svn commit: r316441 - stable/11/usr.bin/sed

Xin LI delphij at FreeBSD.org
Mon Apr 3 06:13:06 UTC 2017


Author: delphij
Date: Mon Apr  3 06:13:05 2017
New Revision: 316441
URL: https://svnweb.freebsd.org/changeset/base/316441

Log:
  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>.

Modified:
  stable/11/usr.bin/sed/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/sed/main.c
==============================================================================
--- stable/11/usr.bin/sed/main.c	Mon Apr  3 06:09:12 2017	(r316440)
+++ stable/11/usr.bin/sed/main.c	Mon Apr  3 06:13:05 2017	(r316441)
@@ -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-stable mailing list