summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-09-09 15:45:03 +0200
committerDaniel Mack <github@zonque.org>2015-09-09 15:45:03 +0200
commit01da201420edfb2a57e384f109def05f25429305 (patch)
tree1c3090f3b5200ba62613285553afa0f7a6d30b9a /src/journal
parent37b76fd3ee5a03d76786e7bd1e0f8596e6ce47d6 (diff)
parent74ca738f6a01fb5fc19c5c3899f5cb1fdc1d7f68 (diff)
Merge pull request #1218 from poettering/safe-fclose
util: introduce safe_fclose() and port everything over to it
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/coredump.c3
-rw-r--r--src/journal/stacktrace.c6
2 files changed, 3 insertions, 6 deletions
diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index 62483a2a05..7d94b145c9 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -512,8 +512,7 @@ static int compose_open_fds(pid_t pid, char **open_fds) {
}
errno = 0;
- fclose(stream);
- stream = NULL;
+ stream = safe_fclose(stream);
if (errno != 0)
return -errno;
diff --git a/src/journal/stacktrace.c b/src/journal/stacktrace.c
index 706c08eac7..98a54ff269 100644
--- a/src/journal/stacktrace.c
+++ b/src/journal/stacktrace.c
@@ -177,8 +177,7 @@ int coredump_make_stack_trace(int fd, const char *executable, char **ret) {
goto finish;
}
- fclose(c.f);
- c.f = NULL;
+ c.f = safe_fclose(c.f);
*ret = buf;
buf = NULL;
@@ -192,8 +191,7 @@ finish:
if (c.elf)
elf_end(c.elf);
- if (c.f)
- fclose(c.f);
+ safe_fclose(c.f);
free(buf);