From 3d94f76c99da13e5603831d0b278f8c8c21bcb02 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 24 Mar 2014 03:22:44 +0100 Subject: util: replace close_pipe() with new safe_close_pair() safe_close_pair() is more like safe_close(), except that it handles pairs of fds, and doesn't make and misleading allusion, as it works similarly well for socketpairs() as for pipe()s... --- src/journal/journal-remote.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/journal/journal-remote.c') diff --git a/src/journal/journal-remote.c b/src/journal/journal-remote.c index 469735663c..4ece14ee77 100644 --- a/src/journal/journal-remote.c +++ b/src/journal/journal-remote.c @@ -89,7 +89,7 @@ static int spawn_child(const char* child, char** argv) { if (child_pid < 0) { r = -errno; log_error("Failed to fork: %m"); - close_pipe(fd); + safe_close_pair(fd); return r; } @@ -101,9 +101,7 @@ static int spawn_child(const char* child, char** argv) { _exit(EXIT_FAILURE); } - r = close_pipe(fd); - if (r < 0) - log_warning("Failed to close pipe fds: %m"); + safe_close_pair(fd); /* Make sure the child goes away when the parent dies */ if (prctl(PR_SET_PDEATHSIG, SIGTERM) < 0) -- cgit v1.2.3-54-g00ecf