From 69f1cad4ca824dbfc560725ee1fb6e12a7c7acef Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 13 Apr 2013 20:54:43 +0100 Subject: libmount: (test) check writing to a file was successful Signed-off-by: Sami Kerola --- libmount/src/lock.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libmount/src/lock.c b/libmount/src/lock.c index e73edf54b..f381e423e 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(), -- cgit v1.2.3-55-g7522