From: Sami Kerola Date: Sat, 13 Apr 2013 19:54:43 +0000 (+0100) Subject: libmount: (test) check writing to a file was successful X-Git-Tag: v2.24-rc1~578 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=69f1cad4ca824dbfc560725ee1fb6e12a7c7acef;p=thirdparty%2Futil-linux.git libmount: (test) check writing to a file was successful Signed-off-by: Sami Kerola --- diff --git a/libmount/src/lock.c b/libmount/src/lock.c index e73edf54b4..f381e423e4 100644 --- a/libmount/src/lock.c +++ b/libmount/src/lock.c @@ -21,6 +21,7 @@ #include #include +#include "closestream.h" #include "pathnames.h" #include "mountP.h" @@ -573,7 +574,9 @@ void increment_data(const char *filename, int verbose, int loopno) err(EXIT_FAILURE, "%d: failed to open: %s", getpid(), filename); fprintf(f, "%ld", num); - fclose(f); + + if (close_stream(f) != 0) + err(EXIT_FAILURE, "write failed: %s", filename); if (verbose) fprintf(stderr, "%d: %s: %ld --> %ld (loop=%d)\n", getpid(),