summaryrefslogtreecommitdiff
path: root/src/fstab-generator/fstab-generator.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-05-16 18:11:12 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-05-16 18:11:32 -0400
commit4652c56c59682f153c34d30b410534e4f0c6fd6a (patch)
treeaa3b99cbbc89b0aad23cd36c323ace20851995e5 /src/fstab-generator/fstab-generator.c
parent0dfb89d3c29163e17d081ac10237aa55d2a95d85 (diff)
Use fflush_and_check() in more places
Diffstat (limited to 'src/fstab-generator/fstab-generator.c')
-rw-r--r--src/fstab-generator/fstab-generator.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 167ec60dc5..11df81a97e 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -275,9 +275,9 @@ static int add_mount(
if (!isempty(filtered) && !streq(filtered, "defaults"))
fprintf(f, "Options=%s\n", filtered);
- 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);
if (!noauto && post) {
lnk = strjoin(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL);
@@ -324,9 +324,9 @@ static int add_mount(
if (r < 0)
return r;
- fflush(f);
- if (ferror(f))
- return log_error_errno(errno, "Failed to write unit file %s: %m", automount_unit);
+ r = fflush_and_check(f);
+ if (r < 0)
+ return log_error_errno(r, "Failed to write unit file %s: %m", automount_unit);
free(lnk);
lnk = strjoin(arg_dest, "/", post, nofail ? ".wants/" : ".requires/", automount_name, NULL);