diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2020-03-31 11:29:37 +0200 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2020-03-31 15:48:03 +0200 |
commit | b46c3e4913f7f234039ebd8104446450917cab8d (patch) | |
tree | 78be6d071efc6bf722fdd68cec96328e700e4698 /src/journal-remote/journal-gatewayd.c | |
parent | *: convert amenable fdopendir() calls to take_fdopendir() (diff) | |
download | systemd-b46c3e4913f7f234039ebd8104446450917cab8d.tar.xz systemd-b46c3e4913f7f234039ebd8104446450917cab8d.zip |
*: use _cleanup_close_ with fdopen() where trivial
Also convert these to use take_fdopen().
Diffstat (limited to '')
-rw-r--r-- | src/journal-remote/journal-gatewayd.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index 459d8e86a1..5177e0d157 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -123,17 +123,15 @@ static int request_meta_ensure_tmp(RequestMeta *m) { if (m->tmp) rewind(m->tmp); else { - int fd; + _cleanup_close_ int fd = -1; fd = open_tmpfile_unlinkable("/tmp", O_RDWR|O_CLOEXEC); if (fd < 0) return fd; - m->tmp = fdopen(fd, "w+"); - if (!m->tmp) { - safe_close(fd); + m->tmp = take_fdopen(&fd, "w+"); + if (!m->tmp) return -errno; - } } return 0; |