~diwic/ubuntu/lucid/pulseaudio/bugfixes

« back to all changes in this revision

Viewing changes to src/pulsecore/start-child.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2008-11-04 15:46:00 UTC
  • mfrom: (1.2.1 upstream) (1.1.6 lenny)
  • Revision ID: james.westby@ubuntu.com-20081104154600-hlzknpcazaam0nxm
Tags: 0.9.13-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Don't build against, and create jack package. Jack is not in main.
  - Remove --disable-per-user-esound-socket from configure flags, as we still
    want per user esound sockets.
  - Remove stop links from rc0 and rc6.
  - Change default resample algorithm and bubffer size.
  - Add alsa configuration files to route alsa applications via pulseaudio.
  - Move libasound2-plugins from Recommends to Depends.
* debian/pulseaudio.preinst: When upgrading from intrepid, remove
  /etc/X11/Xsession.d/70pulseaudio, as this was used to minimize a race
  condition when starting GNOME in intrepid. This race should not exist in
  jaunty once libcanberra is built to use pulseaudio as a backend.
* Do not spawn a pulseaudio server if clients fail to find a running server.
* Remove explicit version dependency for libspeex-dev to allow the package
  to be built for now.
* Regenerate autotools files to work with Ubuntu's newer libtool/libltdl.
* debian/control: libpulsecore5 -> libpulsecore8 to match the library
  soname.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id$ */
2
 
 
3
1
/***
4
2
  This file is part of PulseAudio.
5
3
 
68
66
 
69
67
        return pipe_fds[0];
70
68
    } else {
71
 
#ifdef __linux__
72
 
        DIR* d;
73
 
#endif
74
 
        int max_fd, i;
75
 
 
76
69
        /* child */
77
70
 
78
71
        pa_reset_priority();
89
82
        pa_close(2);
90
83
        pa_assert_se(open("/dev/null", O_WRONLY) == 2);
91
84
 
92
 
#ifdef __linux__
93
 
 
94
 
        if ((d = opendir("/proc/self/fd/"))) {
95
 
 
96
 
            struct dirent *de;
97
 
 
98
 
            while ((de = readdir(d))) {
99
 
                char *e = NULL;
100
 
                int fd;
101
 
 
102
 
                if (de->d_name[0] == '.')
103
 
                    continue;
104
 
 
105
 
                errno = 0;
106
 
                fd = strtol(de->d_name, &e, 10);
107
 
                pa_assert(errno == 0 && e && *e == 0);
108
 
 
109
 
                if (fd >= 3 && dirfd(d) != fd)
110
 
                    pa_close(fd);
111
 
            }
112
 
 
113
 
            closedir(d);
114
 
        } else {
115
 
 
116
 
#endif
117
 
 
118
 
            max_fd = 1024;
119
 
 
120
 
#ifdef HAVE_SYS_RESOURCE_H
121
 
            {
122
 
                struct rlimit r;
123
 
                if (getrlimit(RLIMIT_NOFILE, &r) == 0)
124
 
                    max_fd = r.rlim_max;
125
 
            }
126
 
#endif
127
 
 
128
 
            for (i = 3; i < max_fd; i++)
129
 
                pa_close(i);
130
 
 
131
 
#ifdef __linux__
132
 
        }
133
 
#endif
 
85
        pa_close_all(-1);
 
86
        pa_reset_sigs(-1);
 
87
        pa_unblock_sigs(-1);
134
88
 
135
89
#ifdef PR_SET_PDEATHSIG
136
90
        /* On Linux we can use PR_SET_PDEATHSIG to have the helper
141
95
        prctl(PR_SET_PDEATHSIG, SIGTERM, 0, 0, 0);
142
96
#endif
143
97
 
144
 
#ifdef SIGPIPE
145
 
        /* Make sure that SIGPIPE kills the child process */
146
 
        signal(SIGPIPE, SIG_DFL);
147
 
#endif
148
 
 
149
 
#ifdef SIGTERM
150
 
        /* Make sure that SIGTERM kills the child process */
151
 
        signal(SIGTERM, SIG_DFL);
152
 
#endif
153
 
 
154
98
        execl(name, name, argv1, NULL);
155
99
        _exit(1);
156
100
    }