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)
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"