Commit Diff


commit - c26e21eef791002a56bc9c626f5a94cba4165d09
commit + fae3f56c90a8e133ab63a37fb266354f88fe4911
blob - beae78178b09bd59906f5086985023d4f1b9a79b
blob + 154a8ab843133cfba8b72ec5f8e9660d55e4d327
--- gotwebd/got_operations.c
+++ gotwebd/got_operations.c
@@ -60,7 +60,7 @@ got_gotweb_closefile(FILE *f)
 	if (fseek(f, 0, SEEK_SET) == -1)
 		err = got_error_from_errno("fseek");
 
-	if (err == NULL && ftruncate(fileno(f), 0) == -1)
+	if (ftruncate(fileno(f), 0) == -1 && err == NULL)
 		err = got_error_from_errno("ftruncate");
 
 	if (fclose(f) == EOF && err == NULL)