Module Name:    src
Committed By:   rillig
Date:           Sat Jan 21 11:29:30 UTC 2023

Modified Files:
        src/usr.bin/xlint/xlint: xlint.c

Log Message:
lint: catch more write errors when copying files


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/usr.bin/xlint/xlint/xlint.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/xlint/xlint.c
diff -u src/usr.bin/xlint/xlint/xlint.c:1.106 src/usr.bin/xlint/xlint/xlint.c:1.107
--- src/usr.bin/xlint/xlint/xlint.c:1.106	Sat Jan 21 11:22:21 2023
+++ src/usr.bin/xlint/xlint/xlint.c	Sat Jan 21 11:29:30 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: xlint.c,v 1.106 2023/01/21 11:22:21 rillig Exp $ */
+/* $NetBSD: xlint.c,v 1.107 2023/01/21 11:29:30 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: xlint.c,v 1.106 2023/01/21 11:22:21 rillig Exp $");
+__RCSID("$NetBSD: xlint.c,v 1.107 2023/01/21 11:29:30 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -845,7 +845,7 @@ cat(const list *srcs, const char *dest)
 				warn("read error on %s", src);
 				terminate(-1);
 			}
-			if (write(ofd, buf, (size_t)rlen) == -1) {
+			if (write(ofd, buf, (size_t)rlen) != rlen) {
 				warn("write error on %s", dest);
 				terminate(-1);
 			}

Reply via email to