Author: delphij
Date: Sun Feb  5 08:51:41 2017
New Revision: 313277
URL: https://svnweb.freebsd.org/changeset/base/313277

Log:
  Restore r312404:
  
  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     Sun Feb  5 08:24:37 2017        (r313276)
+++ head/usr.bin/sed/main.c     Sun Feb  5 08:51:41 2017        (r313277)
@@ -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");
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to