Commit Diff


commit - 2c833bdbcf7274909b8ca1a9308f77b1022128eb
commit + 84a2b96d223ec79d31415330020d25182c98ba91
blob - 5a88777208fa24b8f1b512d077757e7c57d8fe04
blob + 4ad005cc318e01737a6c54bb7dc0d0d587a0eeda
--- 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)