Git init
[framework/multimedia/pulseaudio.git] / debian / patches / 0001-Work-around-some-platforms-not-having-O_CLOEXEC.patch
1 From 041bcda2518671a4375e77659c80d1be43625904 Mon Sep 17 00:00:00 2001
2 From: Clint Adams <schizo@debian.org>
3 Date: Sun, 25 Oct 2009 12:35:14 +0000
4 Subject: [PATCH] Work around some platforms not having O_CLOEXEC
5
6 ---
7  src/modules/module-cli.c |    5 +++++
8  1 files changed, 5 insertions(+), 0 deletions(-)
9
10 diff --git a/src/modules/module-cli.c b/src/modules/module-cli.c
11 index 6bd0f4f..b1adb52 100644
12 --- a/src/modules/module-cli.c
13 +++ b/src/modules/module-cli.c
14 @@ -105,7 +105,12 @@ int pa__init(pa_module*m) {
15       * of log messages, particularly because if stdout and stderr are
16       * dup'ed they share the same O_NDELAY, too. */
17  
18 +#ifdef O_CLOEXEC
19      if ((fd = open("/dev/tty", O_RDWR|O_CLOEXEC|O_NONBLOCK)) >= 0) {
20 +#else
21 +    if ((fd = open("/dev/tty", O_RDWR|O_NONBLOCK)) >= 0) {
22 +        pa_make_fd_cloexec(fd);
23 +#endif
24          io = pa_iochannel_new(m->core->mainloop, fd, fd);
25          pa_log_debug("Managed to open /dev/tty.");
26      } else {