summaryrefslogtreecommitdiff
path: root/src/journal-remote
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-03-31 02:29:37 -0700
committerVito Caputo <vcaputo@pengaru.com>2020-03-31 06:48:03 -0700
commitb46c3e4913f7f234039ebd8104446450917cab8d (patch)
tree78be6d071efc6bf722fdd68cec96328e700e4698 /src/journal-remote
parent9f81a592c19a7390eefaca99e8323f13d69c2044 (diff)
downloadsystemd-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.c8
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;