chiark / gitweb /
generator: use fflush_and_check() where appropriate
authorLennart Poettering <lennart@poettering.net>
Fri, 15 May 2015 15:06:59 +0000 (17:06 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 08:56:11 +0000 (09:56 +0100)
src/shared/generator.c

index d48b400..8128499 100644 (file)
@@ -67,9 +67,9 @@ static int write_fsck_sysroot_service(const char *dir, const char *what) {
                 what,
                 device);
 
-        fflush(f);
-        if (ferror(f))
-                return log_error_errno(errno, "Failed to write unit file %s: %m", unit);
+        r = fflush_and_check(f);
+        if (r < 0)
+                return log_error_errno(r, "Failed to write unit file %s: %m", unit);
 
         return 0;
 }