diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2020-03-31 02:29:37 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2020-03-31 06:48:03 -0700 |
commit | b46c3e4913f7f234039ebd8104446450917cab8d (patch) | |
tree | 78be6d071efc6bf722fdd68cec96328e700e4698 /src/journal-remote | |
parent | 9f81a592c19a7390eefaca99e8323f13d69c2044 (diff) | |
download | systemd-b46c3e4913f7f234039ebd8104446450917cab8d.tar.gz |
*: use _cleanup_close_ with fdopen() where trivial
Also convert these to use take_fdopen().
Diffstat (limited to 'src/journal-remote')
-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; |