summaryrefslogtreecommitdiff
path: root/src/basic/calendarspec.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-07-29 20:31:07 +0200
committerLennart Poettering <lennart@poettering.net>2015-07-29 20:31:07 +0200
commitdacd6cee76a08331b8c8616c5f30f70ee49aa2f9 (patch)
tree7a7d73f2ac1f909255361781ca923365b6c9b7c3 /src/basic/calendarspec.c
parent8388607b5851574e50a6e65db98135b793b08910 (diff)
tree-wide: port everything over to fflush_and_check()
Some places invoked fflush() directly with their own manual error checking, let's unify all that by using fflush_and_check(). This also unifies the general error paths of fflush()+rename() file writers.
Diffstat (limited to 'src/basic/calendarspec.c')
-rw-r--r--src/basic/calendarspec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/basic/calendarspec.c b/src/basic/calendarspec.c
index 2fde3e107e..2dcc9c5575 100644
--- a/src/basic/calendarspec.c
+++ b/src/basic/calendarspec.c
@@ -253,6 +253,7 @@ int calendar_spec_to_string(const CalendarSpec *c, char **p) {
char *buf = NULL;
size_t sz = 0;
FILE *f;
+ int r;
assert(c);
assert(p);
@@ -278,12 +279,11 @@ int calendar_spec_to_string(const CalendarSpec *c, char **p) {
fputc(':', f);
format_chain(f, 2, c->second);
- fflush(f);
-
- if (ferror(f)) {
+ r = fflush_and_check(f);
+ if (r < 0) {
free(buf);
fclose(f);
- return -ENOMEM;
+ return r;
}
fclose(f);