summaryrefslogtreecommitdiff
path: root/src/manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-06-04 19:45:53 +0200
committerLennart Poettering <lennart@poettering.net>2010-06-04 19:45:53 +0200
commit2149e37c7954fd98acd54269df5f5eca78eb9d5b (patch)
tree35c87f4f64ebd81cef7f0b44ce7e82dd0951f08d /src/manager.c
parentf92a18f5274ad506aed600b2ed8f4a560c510807 (diff)
manager: dump to usual debug channel on SIGUSR2, don't rely on stdin
Diffstat (limited to 'src/manager.c')
-rw-r--r--src/manager.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/manager.c b/src/manager.c
index 28bc4c3b70..735a1aaa4d 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -1891,10 +1891,32 @@ static int manager_process_signal_fd(Manager *m) {
break;
}
- case SIGUSR2:
- manager_dump_units(m, stdout, "\t");
- manager_dump_jobs(m, stdout, "\t");
+ case SIGUSR2: {
+ FILE *f;
+ char *dump = NULL;
+ size_t size;
+
+ if (!(f = open_memstream(&dump, &size))) {
+ log_warning("Failed to allocate memory stream.");
+ break;
+ }
+
+ manager_dump_units(m, f, "\t");
+ manager_dump_jobs(m, f, "\t");
+
+ if (ferror(f)) {
+ fclose(f);
+ free(dump);
+ log_warning("Failed to write status stream");
+ break;
+ }
+
+ fclose(f);
+ log_dump(LOG_INFO, dump);
+ free(dump);
+
break;
+ }
case SIGHUP:
m->exit_code = MANAGER_RELOAD;