diff options
author | Jaroslav Kysela <perex@perex.cz> | 2013-04-08 14:49:31 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2013-04-08 14:51:39 +0200 |
commit | e05b903b1fb16e967d838edac408304cd4470fee (patch) | |
tree | 680bdeb84d83e3b19c3aba19322925d998db2f14 /alsactl/alsactl.c | |
parent | 46cb355d4ff41c8065b02644b0534ab42d16cb72 (diff) | |
download | alsa-utils-e05b903b1fb16e967d838edac408304cd4470fee.tar.gz |
alsactl: move systemd config to the daemon mode
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'alsactl/alsactl.c')
-rw-r--r-- | alsactl/alsactl.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c index 8a4d9ee..f00cfff 100644 --- a/alsactl/alsactl.c +++ b/alsactl/alsactl.c @@ -159,6 +159,7 @@ int main(int argc, char *argv[]) int init_fallback = 1; /* new default behavior */ int period = 5*60; int background = 0; + int daemoncmd = 0; struct arg *a; struct option *o; int i, j, k, res; @@ -178,7 +179,7 @@ int main(int argc, char *argv[]) if ((a->sarg & 0xff) == 0) continue; o = &long_option[j]; - o->name = args->larg; + o->name = a->larg; o->has_arg = (a->sarg & (ENVARG|FILEARG|INTARG)) != 0; o->flag = NULL; o->val = a->sarg & 0xff; @@ -296,12 +297,15 @@ int main(int argc, char *argv[]) daemon(0, 0); } + cmd = argv[optind]; + daemoncmd = strcmp(cmd, "daemon") == 0 || strcmp(cmd, "rdaemon") == 0; + if (use_syslog) { openlog("alsactl", LOG_CONS|LOG_PID, LOG_DAEMON); - syslog(LOG_INFO, "alsactl " SND_UTIL_VERSION_STR " daemon started"); + if (daemoncmd) + syslog(LOG_INFO, "alsactl " SND_UTIL_VERSION_STR " daemon started"); } - cmd = argv[optind]; if (!strcmp(cmd, "init")) { res = init(initfile, cardname); snd_config_update_free_global(); @@ -328,7 +332,8 @@ int main(int argc, char *argv[]) snd_config_update_free_global(); if (use_syslog) { - syslog(LOG_INFO, "alsactl daemon stopped"); + if (daemoncmd) + syslog(LOG_INFO, "alsactl daemon stopped"); closelog(); } return res < 0 ? -res : 0; |