From d9c4c9509d34ba89db06ff1252f3da18c6fd623b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 12 Sep 2007 00:17:51 +0000 Subject: add new pa_pipe_close() API to close two fds at the same time git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1812 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/daemon/cpulimit.c | 6 +----- src/daemon/main.c | 10 +--------- 2 files changed, 2 insertions(+), 14 deletions(-) (limited to 'src/daemon') diff --git a/src/daemon/cpulimit.c b/src/daemon/cpulimit.c index 4f0adc06..0fe11ea6 100644 --- a/src/daemon/cpulimit.c +++ b/src/daemon/cpulimit.c @@ -222,11 +222,7 @@ void pa_cpu_limit_done(void) { api = NULL; } - if (the_pipe[0] >= 0) - pa_assert_se(pa_close(the_pipe[0]) == 0); - if (the_pipe[1] >= 0) - pa_assert_se(pa_close(the_pipe[1]) == 0); - the_pipe[0] = the_pipe[1] = -1; + pa_close_pipe(the_pipe); if (installed) { pa_assert_se(sigaction(SIGXCPU, &sigaction_prev, NULL) >= 0); diff --git a/src/daemon/main.c b/src/daemon/main.c index 0bbddffa..93d4eb6b 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -158,14 +158,6 @@ static void signal_callback(pa_mainloop_api*m, PA_GCC_UNUSED pa_signal_event *e, } } -static void close_pipe(int p[2]) { - if (p[0] != -1) - pa_assert_se(pa_close(p[0]) == 0); - if (p[1] != -1) - pa_assert_se(pa_close(p[1]) == 0); - p[0] = p[1] = -1; -} - #define set_env(key, value) putenv(pa_sprintf_malloc("%s=%s", (key), (value))) #if defined(HAVE_PWD_H) && defined(HAVE_GRP_H) @@ -745,7 +737,7 @@ finish: if (valid_pid_file) pa_pid_file_remove(); - close_pipe(daemon_pipe); + pa_close_pipe(daemon_pipe); #ifdef OS_IS_WIN32 WSACleanup(); -- cgit