svn commit: r303452 - head/usr.bin/indent

Pedro F. Giffuni pfg at FreeBSD.org
Thu Jul 28 16:54:14 UTC 2016


Author: pfg
Date: Thu Jul 28 16:54:12 2016
New Revision: 303452
URL: https://svnweb.freebsd.org/changeset/base/303452

Log:
  indent: avoid calling write(2) with a negative second parameter.
  
  negative_returns: n is passed to a parameter that cannot be negative.
  Fix a style issue while here.
  
  CID:	1008107

Modified:
  head/usr.bin/indent/indent.c

Modified: head/usr.bin/indent/indent.c
==============================================================================
--- head/usr.bin/indent/indent.c	Thu Jul 28 16:20:27 2016	(r303451)
+++ head/usr.bin/indent/indent.c	Thu Jul 28 16:54:12 2016	(r303452)
@@ -1213,7 +1213,7 @@ bakcopy(void)
     bakchn = creat(bakfile, 0600);
     if (bakchn < 0)
 	err(1, "%s", bakfile);
-    while ((n = read(fileno(input), buff, sizeof buff)) != 0)
+    while ((n = read(fileno(input), buff, sizeof(buff))) > 0)
 	if (write(bakchn, buff, n) != n)
 	    err(1, "%s", bakfile);
     if (n < 0)


More information about the svn-src-head mailing list