PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2 of the License,
+ by the Free Software Foundation; either version 2.1 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <fcntl.h>
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#include <pulse/xmalloc.h>
-#include <pulse/gccmacro.h>
#include <pulsecore/core-error.h>
#include <pulsecore/core-util.h>
+#include <pulsecore/i18n.h>
#include <pulsecore/log.h>
#include <pulsecore/macro.h>
signal(sig, signal_handler);
#endif
- pa_write(signal_pipe[1], &sig, sizeof(sig), NULL);
+ /* XXX: If writing fails, there's nothing we can do? */
+ (void) pa_write(signal_pipe[1], &sig, sizeof(sig), NULL);
errno = saved_errno;
}
}
}
-static void callback(pa_mainloop_api*a, pa_io_event*e, int fd, pa_io_event_flags_t f, PA_GCC_UNUSED void *userdata) {
+static void callback(pa_mainloop_api*a, pa_io_event*e, int fd, pa_io_event_flags_t f, void *userdata) {
ssize_t r;
int sig;
pa_assert(signal_pipe[1] == -1);
pa_assert(!io_event);
- if (pipe(signal_pipe) < 0) {
+ if (pa_pipe_cloexec(signal_pipe) < 0) {
pa_log("pipe(): %s", pa_cstrerror(errno));
return -1;
}
pa_make_fd_nonblock(signal_pipe[0]);
pa_make_fd_nonblock(signal_pipe[1]);
- pa_make_fd_cloexec(signal_pipe[0]);
- pa_make_fd_cloexec(signal_pipe[1]);
api = a;
pa_assert(sig > 0);
pa_assert(_callback);
+ pa_init_i18n();
+
for (e = signals; e; e = e->next)
if (e->sig == sig)
- goto fail;
+ return NULL;
e = pa_xnew(pa_signal_event, 1);
e->sig = sig;
return e;
fail:
- if (e)
- pa_xfree(e);
+ pa_xfree(e);
return NULL;
}