summaryrefslogtreecommitdiffstats
path: root/polyp
diff options
context:
space:
mode:
Diffstat (limited to 'polyp')
-rw-r--r--polyp/core.h2
-rw-r--r--polyp/main.c2
-rw-r--r--polyp/module-cli.c11
3 files changed, 12 insertions, 3 deletions
diff --git a/polyp/core.h b/polyp/core.h
index 36604424..8ef66570 100644
--- a/polyp/core.h
+++ b/polyp/core.h
@@ -59,7 +59,7 @@ struct pa_core {
struct pa_memblock_stat *memblock_stat;
- int disallow_module_loading;
+ int disallow_module_loading, running_as_daemon;
int exit_idle_time, module_idle_time, scache_idle_time;
struct pa_time_event *quit_event;
diff --git a/polyp/main.c b/polyp/main.c
index e881821e..26fa4a87 100644
--- a/polyp/main.c
+++ b/polyp/main.c
@@ -296,6 +296,8 @@ int main(int argc, char *argv[]) {
c = pa_core_new(pa_mainloop_get_api(mainloop));
assert(c);
+ if (conf->daemonize)
+ c->running_as_daemon = 1;
pa_signal_new(SIGUSR1, signal_callback, c);
pa_signal_new(SIGUSR2, signal_callback, c);
diff --git a/polyp/module-cli.c b/polyp/module-cli.c
index 55fe8ad4..7d278f90 100644
--- a/polyp/module-cli.c
+++ b/polyp/module-cli.c
@@ -50,6 +50,11 @@ int pa__init(struct pa_core *c, struct pa_module*m) {
struct pa_iochannel *io;
assert(c && m);
+ if (c->running_as_daemon) {
+ pa_log_info(__FILE__": Running as daemon so won't load this module.\n");
+ return 0;
+ }
+
if (m->argument) {
pa_log(__FILE__": module doesn't accept arguments.\n");
return -1;
@@ -75,6 +80,8 @@ int pa__init(struct pa_core *c, struct pa_module*m) {
void pa__done(struct pa_core *c, struct pa_module*m) {
assert(c && m);
- pa_cli_free(m->userdata);
- pa_stdio_release();
+ if (c->running_as_daemon == 0) {
+ pa_cli_free(m->userdata);
+ pa_stdio_release();
+ }
}