commit cbe7f84890b5be0eb0e47f67f1606f66db181eae from: Stefan Sperling date: Mon Feb 11 10:35:55 2019 UTC check for fflush() errors commit - e135804eb13a827d9984bab054db65479e341e6a commit + cbe7f84890b5be0eb0e47f67f1606f66db181eae blob - ca784f2d06a5b67919ef72127efe1ce8215efb01 blob + 1cd61521b11013a94063f2b53ddec0e8c0252379 --- got/got.c +++ got/got.c @@ -690,7 +690,8 @@ print_commit(struct got_commit_object *commit, struct printf("\n"); } - fflush(stdout); + if (fflush(stdout) != 0 && err == NULL) + err = got_error_from_errno(); return err; } blob - 9e996be8927905881cbb34dd4115ed38a682c390 blob + dcfc275c4a821d058821851f9fad0ed53f752e51 --- lib/diff3.c +++ lib/diff3.c @@ -240,7 +240,10 @@ diffreg(BUF **d, const char *path1, const char *path2) if (err) goto done; - fflush(outfile); + if (fflush(outfile) != 0) { + err = got_error_from_errno(); + goto done; + } *d = buf_load(outpath); if (*d == NULL) blob - 785760891223c8f4348d08e21d81613e174e50e2 blob + 4dd68b61711b0c1ffeead295235e4c837415af37 --- lib/object.c +++ lib/object.c @@ -1161,7 +1161,8 @@ got_object_blob_dump_to_file(size_t *total_len, int *n hdrlen = 0; } while (len != 0); - fflush(outfile); + if (fflush(outfile) != 0) + return got_error_from_errno(); rewind(outfile); return NULL; blob - ba0eaebcee73e1d0bcd1045b6b68611e0492eaf9 blob + dd0a9ea2287596227b3ce25a45daa5cba4350894 --- tog/tog.c +++ tog/tog.c @@ -1967,8 +1967,8 @@ create_diff(struct tog_diff_view_state *s) break; } done: - if (f) - fflush(f); + if (f && fflush(f) != 0 && err == NULL) + err = got_error_from_errno(); return err; }