Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--agent/tcf/framework/trace.c2
-rw-r--r--agent/tcf/framework/trace.h2
-rw-r--r--agent/tcf/main/main.c8
3 files changed, 10 insertions, 2 deletions
diff --git a/agent/tcf/framework/trace.c b/agent/tcf/framework/trace.c
index 5cc0dcd4..bd08328b 100644
--- a/agent/tcf/framework/trace.c
+++ b/agent/tcf/framework/trace.c
@@ -169,7 +169,7 @@ void open_log_file(const char * log_name) {
if (log_name == NULL) {
log_file = NULL;
}
- else if (strcmp(log_name, "-") == 0) {
+ else if (strcmp(log_name, LOG_NAME_STDERR) == 0) {
log_file = stderr;
}
else if ((log_file = fopen(log_name, "a")) == NULL) {
diff --git a/agent/tcf/framework/trace.h b/agent/tcf/framework/trace.h
index 3e787a19..9cddd35f 100644
--- a/agent/tcf/framework/trace.h
+++ b/agent/tcf/framework/trace.h
@@ -41,6 +41,8 @@
#define LOG_STACK 0x2000
#define LOG_PLUGIN 0x4000
+#define LOG_NAME_STDERR "-"
+
extern int log_mode;
#if ENABLE_Trace
diff --git a/agent/tcf/main/main.c b/agent/tcf/main/main.c
index ec363f75..b2c83f83 100644
--- a/agent/tcf/main/main.c
+++ b/agent/tcf/main/main.c
@@ -117,7 +117,7 @@ static BOOL CtrlHandler(DWORD ctrl) {
static const char * help_text[] = {
"Usage: agent [OPTION]...",
"Start Target Communication Framework agent.",
- " -d run in daemon mode",
+ " -d run in daemon mode (output is sent to system logger)",
#if ENABLE_Cmdline
" -i run in interactive mode",
#endif
@@ -274,6 +274,12 @@ int main(int argc, char ** argv) {
}
}
+ if (daemon && strcmp (log_name, LOG_NAME_STDERR) != 0 && log_name != NULL) {
+ fprintf(stderr, "%s: error: can only log to stderr when in daemon "
+ "mode.\n", progname);
+ exit (1);
+ }
+
if (daemon) become_daemon();
open_log_file(log_name);

Back to the top