mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-10 13:29:58 -05:00
Huge trailing whitespace cleanup. Let's keep the tree pure from here on,
mmmkay? git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1418 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
1a460ee40a
commit
521daf6f0a
283 changed files with 3742 additions and 3742 deletions
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
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,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -50,7 +50,7 @@ int setresuid(uid_t r, uid_t e, uid_t s);
|
|||
/* Drop root rights when called SUID root */
|
||||
void pa_drop_root(void) {
|
||||
uid_t uid = getuid();
|
||||
|
||||
|
||||
if (uid == 0 || geteuid() != 0)
|
||||
return;
|
||||
|
||||
|
|
@ -96,13 +96,13 @@ int pa_limit_caps(void) {
|
|||
if (cap_set_proc(caps) < 0)
|
||||
goto fail;
|
||||
|
||||
pa_log_info("dropped capabilities successfully.");
|
||||
|
||||
pa_log_info("dropped capabilities successfully.");
|
||||
|
||||
r = 0;
|
||||
|
||||
fail:
|
||||
cap_free (caps);
|
||||
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
@ -124,12 +124,12 @@ int pa_drop_caps(void) {
|
|||
pa_log("failed to drop capabilities: %s", pa_cstrerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
r = 0;
|
||||
|
||||
fail:
|
||||
cap_free (caps);
|
||||
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,17 +5,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
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,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
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,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -100,7 +100,7 @@ void pa_cmdline_help(const char *argv0) {
|
|||
e++;
|
||||
else
|
||||
e = argv0;
|
||||
|
||||
|
||||
printf("%s [options]\n\n"
|
||||
"COMMANDS:\n"
|
||||
" -h, --help Show this help\n"
|
||||
|
|
@ -124,7 +124,7 @@ void pa_cmdline_help(const char *argv0) {
|
|||
" --scache-idle-time=SECS Unload autoloaded samples when idle and\n"
|
||||
" this time passed\n"
|
||||
" --log-level[=LEVEL] Increase or set verbosity level\n"
|
||||
" -v Increase the verbosity level\n"
|
||||
" -v Increase the verbosity level\n"
|
||||
" --log-target={auto,syslog,stderr} Specify the log target\n"
|
||||
" -p, --dl-search-path=PATH Set the search path for dynamic shared\n"
|
||||
" objects (plugins)\n"
|
||||
|
|
@ -143,7 +143,7 @@ void pa_cmdline_help(const char *argv0) {
|
|||
" -F, --file=FILENAME Run the specified script\n"
|
||||
" -C Open a command line on the running TTY\n"
|
||||
" after startup\n\n"
|
||||
|
||||
|
||||
" -n Don't load default script file\n", e);
|
||||
}
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
|
|||
|
||||
if (conf->script_commands)
|
||||
pa_strbuf_puts(buf, conf->script_commands);
|
||||
|
||||
|
||||
while ((c = getopt_long(argc, argv, "L:F:ChDnp:kv", long_options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case ARG_HELP:
|
||||
|
|
@ -184,21 +184,21 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
|
|||
case ARG_CHECK:
|
||||
conf->cmd = PA_CMD_CHECK;
|
||||
break;
|
||||
|
||||
|
||||
case ARG_LOAD:
|
||||
case 'L':
|
||||
pa_strbuf_printf(buf, "load-module %s\n", optarg);
|
||||
break;
|
||||
|
||||
|
||||
case ARG_FILE:
|
||||
case 'F':
|
||||
pa_strbuf_printf(buf, ".include %s\n", optarg);
|
||||
break;
|
||||
|
||||
|
||||
case 'C':
|
||||
pa_strbuf_puts(buf, "load-module module-cli exit_on_eof=1\n");
|
||||
break;
|
||||
|
||||
|
||||
case ARG_DAEMONIZE:
|
||||
case 'D':
|
||||
if ((conf->daemonize = optarg ? pa_parse_boolean(optarg) : 1) < 0) {
|
||||
|
|
@ -226,7 +226,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
|
|||
if (conf->log_level < PA_LOG_LEVEL_MAX-1)
|
||||
conf->log_level++;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case ARG_HIGH_PRIORITY:
|
||||
|
|
@ -249,13 +249,13 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
|
|||
goto fail;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'p':
|
||||
case ARG_DL_SEARCH_PATH:
|
||||
pa_xfree(conf->dl_search_path);
|
||||
conf->dl_search_path = *optarg ? pa_xstrdup(optarg) : NULL;
|
||||
break;
|
||||
|
||||
|
||||
case 'n':
|
||||
pa_xfree(conf->default_script_file);
|
||||
conf->default_script_file = NULL;
|
||||
|
|
@ -307,7 +307,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
|
|||
goto fail;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -322,12 +322,12 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
|
|||
}
|
||||
|
||||
*d = optind;
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
fail:
|
||||
if (buf)
|
||||
pa_strbuf_free(buf);
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,17 +5,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
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,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
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, or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -80,7 +80,7 @@ static pa_io_event *io_event = NULL;
|
|||
static struct sigaction sigaction_prev;
|
||||
|
||||
/* Nonzero after pa_cpu_limit_init() */
|
||||
static int installed = 0;
|
||||
static int installed = 0;
|
||||
|
||||
/* The current state of operation */
|
||||
static enum {
|
||||
|
|
@ -131,24 +131,24 @@ static void signal_handler(int sig) {
|
|||
snprintf(t, sizeof(t), "Using %0.1f%% CPU\n", (double)CPUTIME_INTERVAL_SOFT/(now-last_time)*100);
|
||||
write_err(t);
|
||||
#endif
|
||||
|
||||
|
||||
if (CPUTIME_INTERVAL_SOFT >= ((now-last_time)*(double)CPUTIME_PERCENT/100)) {
|
||||
static const char c = 'X';
|
||||
|
||||
write_err("Soft CPU time limit exhausted, terminating.\n");
|
||||
|
||||
|
||||
/* Try a soft cleanup */
|
||||
write(the_pipe[1], &c, sizeof(c));
|
||||
phase = PHASE_SOFT;
|
||||
reset_cpu_time(CPUTIME_INTERVAL_HARD);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
/* Everything's fine */
|
||||
reset_cpu_time(CPUTIME_INTERVAL_SOFT);
|
||||
last_time = now;
|
||||
}
|
||||
|
||||
|
||||
} else if (phase == PHASE_SOFT) {
|
||||
write_err("Hard CPU time limit exhausted, terminating forcibly.\n");
|
||||
_exit(1); /* Forced exit */
|
||||
|
|
@ -167,7 +167,7 @@ static void callback(pa_mainloop_api*m, pa_io_event*e, int fd, pa_io_event_flags
|
|||
int pa_cpu_limit_init(pa_mainloop_api *m) {
|
||||
struct sigaction sa;
|
||||
assert(m && !api && !io_event && the_pipe[0] == -1 && the_pipe[1] == -1 && !installed);
|
||||
|
||||
|
||||
time(&last_time);
|
||||
|
||||
/* Prepare the main loop pipe */
|
||||
|
|
@ -191,7 +191,7 @@ int pa_cpu_limit_init(pa_mainloop_api *m) {
|
|||
sa.sa_handler = signal_handler;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = SA_RESTART;
|
||||
|
||||
|
||||
if (sigaction(SIGXCPU, &sa, &sigaction_prev) < 0) {
|
||||
pa_cpu_limit_done();
|
||||
return -1;
|
||||
|
|
@ -200,7 +200,7 @@ int pa_cpu_limit_init(pa_mainloop_api *m) {
|
|||
installed = 1;
|
||||
|
||||
reset_cpu_time(CPUTIME_INTERVAL_SOFT);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,17 +5,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
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,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ static int parse_rlimit(const char *filename, unsigned line, const char *lvalue,
|
|||
int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
|
||||
int r = -1;
|
||||
FILE *f = NULL;
|
||||
|
||||
|
||||
pa_config_item table[] = {
|
||||
{ "daemonize", pa_config_parse_bool, NULL },
|
||||
{ "fail", pa_config_parse_bool, NULL },
|
||||
|
|
@ -266,7 +266,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
|
|||
#endif
|
||||
{ NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
|
||||
table[0].data = &c->daemonize;
|
||||
table[1].data = &c->fail;
|
||||
table[2].data = &c->high_priority;
|
||||
|
|
@ -301,8 +301,8 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
|
|||
table[24].data = &c->rlimit_memlock;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
pa_xfree(c->config_file);
|
||||
c->config_file = NULL;
|
||||
|
||||
|
|
@ -316,11 +316,11 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
|
|||
}
|
||||
|
||||
r = f ? pa_config_parse(c->config_file, f, table, NULL) : 0;
|
||||
|
||||
|
||||
finish:
|
||||
if (f)
|
||||
fclose(f);
|
||||
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
@ -354,7 +354,7 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
|
|||
pa_strbuf_printf(s, "### Read from configuration file: %s ###\n", c->config_file);
|
||||
|
||||
assert(c->log_level <= PA_LOG_LEVEL_MAX);
|
||||
|
||||
|
||||
pa_strbuf_printf(s, "daemonize = %i\n", !!c->daemonize);
|
||||
pa_strbuf_printf(s, "fail = %i\n", !!c->fail);
|
||||
pa_strbuf_printf(s, "high-priority = %i\n", !!c->high_priority);
|
||||
|
|
@ -385,6 +385,6 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
|
|||
pa_strbuf_printf(s, "rlimit-memlock = %li\n", c->rlimit_memlock.is_set ? (long int) c->rlimit_memlock.value : -1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
return pa_strbuf_tostring_free(s);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ typedef struct pa_daemon_conf {
|
|||
pa_log_level_t log_level;
|
||||
int resample_method;
|
||||
char *config_file;
|
||||
|
||||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
pa_rlimit rlimit_as, rlimit_core, rlimit_data, rlimit_fsize, rlimit_nofile, rlimit_stack;
|
||||
#ifdef RLIMIT_NPROC
|
||||
|
|
@ -76,7 +76,7 @@ typedef struct pa_daemon_conf {
|
|||
pa_rlimit rlimit_memlock;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
} pa_daemon_conf;
|
||||
|
||||
/* Allocate a new structure and fill it with sane defaults */
|
||||
|
|
|
|||
|
|
@ -45,14 +45,14 @@ static void short_info(const char *name, PA_GCC_UNUSED const char *path, pa_modi
|
|||
static void long_info(const char *name, const char *path, pa_modinfo *i) {
|
||||
static int nl = 0;
|
||||
assert(name && i);
|
||||
|
||||
|
||||
if (nl)
|
||||
printf("\n");
|
||||
|
||||
nl = 1;
|
||||
|
||||
printf("Name: %s\n", name);
|
||||
|
||||
|
||||
if (!i->description && !i->version && !i->author && !i->usage)
|
||||
printf("No module information available\n");
|
||||
else {
|
||||
|
|
@ -65,14 +65,14 @@ static void long_info(const char *name, const char *path, pa_modinfo *i) {
|
|||
if (i->usage)
|
||||
printf("Usage: %s\n", i->usage);
|
||||
}
|
||||
|
||||
|
||||
if (path)
|
||||
printf("Path: %s\n", path);
|
||||
}
|
||||
|
||||
static void show_info(const char *name, const char *path, void (*info)(const char *name, const char *path, pa_modinfo*i)) {
|
||||
pa_modinfo *i;
|
||||
|
||||
|
||||
if ((i = pa_modinfo_get_by_name(path ? path : name))) {
|
||||
info(name, path, i);
|
||||
pa_modinfo_free(i);
|
||||
|
|
@ -86,10 +86,10 @@ static int is_preloaded(const char *name) {
|
|||
|
||||
for (l = lt_preloaded_symbols; l->name; l++) {
|
||||
char buf[64], *e;
|
||||
|
||||
|
||||
if (l->address)
|
||||
continue;
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s", l->name);
|
||||
if ((e = strrchr(buf, '.')))
|
||||
*e = 0;
|
||||
|
|
@ -112,7 +112,7 @@ static int callback(const char *path, lt_ptr data) {
|
|||
|
||||
if (is_preloaded(e))
|
||||
return 0;
|
||||
|
||||
|
||||
show_info(e, path, c->log_level >= PA_LOG_INFO ? long_info : short_info);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -127,20 +127,20 @@ void pa_dump_modules(pa_daemon_conf *c, int argc, char * const argv[]) {
|
|||
|
||||
for (l = lt_preloaded_symbols; l->name; l++) {
|
||||
char buf[64], *e;
|
||||
|
||||
|
||||
if (l->address)
|
||||
continue;
|
||||
|
||||
if (strlen(l->name) <= sizeof(PREFIX)-1 || strncmp(l->name, PREFIX, sizeof(PREFIX)-1))
|
||||
continue;
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s", l->name);
|
||||
if ((e = strrchr(buf, '.')))
|
||||
*e = 0;
|
||||
|
||||
|
||||
show_info(buf, NULL, c->log_level >= PA_LOG_INFO ? long_info : short_info);
|
||||
}
|
||||
|
||||
|
||||
lt_dlforeachfile(NULL, callback, c);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
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,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -125,7 +125,7 @@ static void signal_callback(pa_mainloop_api*m, PA_GCC_UNUSED pa_signal_event *e,
|
|||
pa_module_load(userdata, "module-cli", NULL);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SIGUSR2
|
||||
case SIGUSR2:
|
||||
pa_module_load(userdata, "module-cli-protocol-unix", NULL);
|
||||
|
|
@ -170,7 +170,7 @@ static int change_user(void) {
|
|||
/* This function is called only in system-wide mode. It creates a
|
||||
* runtime dir in /var/run/ with proper UID/GID and drops privs
|
||||
* afterwards. */
|
||||
|
||||
|
||||
if (!(pw = getpwnam(PA_SYSTEM_USER))) {
|
||||
pa_log("Failed to find user '%s'.", PA_SYSTEM_USER);
|
||||
return -1;
|
||||
|
|
@ -197,7 +197,7 @@ static int change_user(void) {
|
|||
pa_log("Failed to create '%s': %s", PA_SYSTEM_RUNTIME_PATH, pa_cstrerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (initgroups(PA_SYSTEM_USER, gr->gr_gid) != 0) {
|
||||
pa_log("Failed to change group list: %s", pa_cstrerror(errno));
|
||||
return -1;
|
||||
|
|
@ -265,7 +265,7 @@ static int create_runtime_dir(void) {
|
|||
/* This function is called only when the daemon is started in
|
||||
* per-user mode. We create the runtime directory somewhere in
|
||||
* /tmp/ with the current UID/GID */
|
||||
|
||||
|
||||
if (pa_make_secure_dir(fn, 0700, (uid_t)-1, (gid_t)-1) < 0) {
|
||||
pa_log("Failed to create '%s': %s", fn, pa_cstrerror(errno));
|
||||
return -1;
|
||||
|
|
@ -311,7 +311,7 @@ int main(int argc, char *argv[]) {
|
|||
pa_daemon_conf *conf = NULL;
|
||||
pa_mainloop *mainloop = NULL;
|
||||
|
||||
char *s;
|
||||
char *s;
|
||||
int r, retval = 1, d = 0;
|
||||
int daemon_pipe[2] = { -1, -1 };
|
||||
int suid_root, real_root;
|
||||
|
|
@ -333,7 +333,7 @@ int main(int argc, char *argv[]) {
|
|||
#ifdef HAVE_GETUID
|
||||
real_root = getuid() == 0;
|
||||
suid_root = !real_root && geteuid() == 0;
|
||||
|
||||
|
||||
if (suid_root && (pa_own_uid_in_group(PA_REALTIME_GROUP, &gid) <= 0 || gid >= 1000)) {
|
||||
pa_log_warn("WARNING: called SUID root, but not in group '"PA_REALTIME_GROUP"'.");
|
||||
pa_drop_root();
|
||||
|
|
@ -342,9 +342,9 @@ int main(int argc, char *argv[]) {
|
|||
real_root = 0;
|
||||
suid_root = 0;
|
||||
#endif
|
||||
|
||||
|
||||
LTDL_SET_PRELOADED_SYMBOLS();
|
||||
|
||||
|
||||
r = lt_dlinit();
|
||||
assert(r == 0);
|
||||
|
||||
|
|
@ -356,11 +356,11 @@ int main(int argc, char *argv[]) {
|
|||
#endif
|
||||
|
||||
pa_random_seed();
|
||||
|
||||
|
||||
pa_log_set_ident("pulseaudio");
|
||||
|
||||
|
||||
conf = pa_daemon_conf_new();
|
||||
|
||||
|
||||
if (pa_daemon_conf_load(conf, NULL) < 0)
|
||||
goto finish;
|
||||
|
||||
|
|
@ -429,9 +429,9 @@ int main(int argc, char *argv[]) {
|
|||
pa_log("failed to kill daemon.");
|
||||
else
|
||||
retval = 0;
|
||||
|
||||
|
||||
goto finish;
|
||||
|
||||
|
||||
default:
|
||||
assert(conf->cmd == PA_CMD_DAEMON);
|
||||
}
|
||||
|
|
@ -457,7 +457,7 @@ int main(int argc, char *argv[]) {
|
|||
pa_log("failed to create pipe.");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
||||
if ((child = fork()) < 0) {
|
||||
pa_log("fork() failed: %s", pa_cstrerror(errno));
|
||||
goto finish;
|
||||
|
|
@ -478,7 +478,7 @@ int main(int argc, char *argv[]) {
|
|||
pa_log("daemon startup failed.");
|
||||
else
|
||||
pa_log_info("daemon startup successful.");
|
||||
|
||||
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
@ -517,7 +517,7 @@ int main(int argc, char *argv[]) {
|
|||
#ifdef SIGTSTP
|
||||
signal(SIGTSTP, SIG_IGN);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TIOCNOTTY
|
||||
if ((tty_fd = open("/dev/tty", O_RDWR)) >= 0) {
|
||||
ioctl(tty_fd, TIOCNOTTY, (char*) 0);
|
||||
|
|
@ -528,13 +528,13 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
chdir("/");
|
||||
umask(0022);
|
||||
|
||||
|
||||
if (conf->system_instance) {
|
||||
if (change_user() < 0)
|
||||
goto finish;
|
||||
} else if (create_runtime_dir() < 0)
|
||||
goto finish;
|
||||
|
||||
|
||||
if (conf->use_pid_file) {
|
||||
if (pa_pid_file_create() < 0) {
|
||||
pa_log("pa_pid_file_create() failed.");
|
||||
|
|
@ -551,7 +551,7 @@ int main(int argc, char *argv[]) {
|
|||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
set_all_rlimits(conf);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SIGPIPE
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
|
|
@ -580,7 +580,7 @@ int main(int argc, char *argv[]) {
|
|||
#ifdef SIGHUP
|
||||
pa_signal_new(SIGHUP, signal_callback, c);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef OS_IS_WIN32
|
||||
timer = pa_mainloop_get_api(mainloop)->time_new(
|
||||
pa_mainloop_get_api(mainloop), pa_gettimeofday(&tv), message_cb, NULL);
|
||||
|
|
@ -596,7 +596,7 @@ int main(int argc, char *argv[]) {
|
|||
r = pa_cpu_limit_init(pa_mainloop_get_api(mainloop));
|
||||
assert(r == 0);
|
||||
}
|
||||
|
||||
|
||||
buf = pa_strbuf_new();
|
||||
if (conf->default_script_file)
|
||||
r = pa_cli_command_execute_file(c, conf->default_script_file, buf, &conf->fail);
|
||||
|
|
@ -605,7 +605,7 @@ int main(int argc, char *argv[]) {
|
|||
r = pa_cli_command_execute(c, conf->script_commands, buf, &conf->fail);
|
||||
pa_log_error("%s", s = pa_strbuf_tostring_free(buf));
|
||||
pa_xfree(s);
|
||||
|
||||
|
||||
if (r < 0 && conf->fail) {
|
||||
pa_log("failed to initialize daemon.");
|
||||
#ifdef HAVE_FORK
|
||||
|
|
@ -652,11 +652,11 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
if (!conf->no_cpu_limit)
|
||||
pa_cpu_limit_done();
|
||||
|
||||
|
||||
pa_signal_done();
|
||||
|
||||
|
||||
pa_log_info("Daemon terminated.");
|
||||
|
||||
|
||||
finish:
|
||||
|
||||
if (mainloop)
|
||||
|
|
@ -667,7 +667,7 @@ finish:
|
|||
|
||||
if (valid_pid_file)
|
||||
pa_pid_file_remove();
|
||||
|
||||
|
||||
close_pipe(daemon_pipe);
|
||||
|
||||
#ifdef OS_IS_WIN32
|
||||
|
|
@ -675,6 +675,6 @@ finish:
|
|||
#endif
|
||||
|
||||
lt_dlexit();
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue