chiark
/
gitweb
/
~mdw
/
disorder
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
server subprocesses should log to the same place the server does
[disorder]
/
server
/
speaker.c
diff --git
a/server/speaker.c
b/server/speaker.c
index bdebbbdd464ae504f7adc34ae7c710696a07c508..55dde7ee9bbf2572da6e317bf9e2ecfb378982cb 100644
(file)
--- a/
server/speaker.c
+++ b/
server/speaker.c
@@
-117,6
+117,8
@@
static const struct option options[] = {
{ "config", required_argument, 0, 'c' },
{ "debug", no_argument, 0, 'd' },
{ "no-debug", no_argument, 0, 'D' },
{ "config", required_argument, 0, 'c' },
{ "debug", no_argument, 0, 'd' },
{ "no-debug", no_argument, 0, 'D' },
+ { "syslog", no_argument, 0, 's' },
+ { "no-syslog", no_argument, 0, 'S' },
{ 0, 0, 0, 0 }
};
{ 0, 0, 0, 0 }
};
@@
-129,6
+131,7
@@
static void help(void) {
" --version, -V Display version number\n"
" --config PATH, -c PATH Set configuration file\n"
" --debug, -d Turn on debugging\n"
" --version, -V Display version number\n"
" --config PATH, -c PATH Set configuration file\n"
" --debug, -d Turn on debugging\n"
+ " --[no-]syslog Force logging\n"
"\n"
"Speaker process for DisOrder. Not intended to be run\n"
"directly.\n");
"\n"
"Speaker process for DisOrder. Not intended to be run\n"
"directly.\n");
@@
-582,7
+585,7
@@
static void mainloop(void) {
}
int main(int argc, char **argv) {
}
int main(int argc, char **argv) {
- int n;
+ int n
, logsyslog = !isatty(2)
;
struct sockaddr_un addr;
static const int one = 1;
struct speaker_message sm;
struct sockaddr_un addr;
static const int one = 1;
struct speaker_message sm;
@@
-590,19
+593,20
@@
int main(int argc, char **argv) {
set_progname(argv);
if(!setlocale(LC_CTYPE, "")) fatal(errno, "error calling setlocale");
set_progname(argv);
if(!setlocale(LC_CTYPE, "")) fatal(errno, "error calling setlocale");
- while((n = getopt_long(argc, argv, "hVc:dD", options, 0)) >= 0) {
+ while((n = getopt_long(argc, argv, "hVc:dD
Ss
", options, 0)) >= 0) {
switch(n) {
case 'h': help();
case 'V': version();
case 'c': configfile = optarg; break;
case 'd': debugging = 1; break;
case 'D': debugging = 0; break;
switch(n) {
case 'h': help();
case 'V': version();
case 'c': configfile = optarg; break;
case 'd': debugging = 1; break;
case 'D': debugging = 0; break;
+ case 'S': logsyslog = 0; break;
+ case 's': logsyslog = 1; break;
default: fatal(0, "invalid option");
}
}
if((d = getenv("DISORDER_DEBUG_SPEAKER"))) debugging = atoi(d);
default: fatal(0, "invalid option");
}
}
if((d = getenv("DISORDER_DEBUG_SPEAKER"))) debugging = atoi(d);
- /* If stderr is a TTY then log there, otherwise to syslog. */
- if(!isatty(2)) {
+ if(logsyslog) {
openlog(progname, LOG_PID, LOG_DAEMON);
log_default = &log_syslog;
}
openlog(progname, LOG_PID, LOG_DAEMON);
log_default = &log_syslog;
}