summaryrefslogtreecommitdiff
path: root/src/core/execute.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-08-21 16:15:49 +0200
committerLennart Poettering <lennart@poettering.net>2014-08-21 17:24:21 +0200
commit4c94096027f21d4ed0efe991534a926d39d52369 (patch)
tree5e148edac536bc86ef4817f6ea986591c19e8096 /src/core/execute.c
parent5ed1227238724959f020169f5332086439709b55 (diff)
core: unify how we generate the prefix string when dumping unit state
Diffstat (limited to 'src/core/execute.c')
-rw-r--r--src/core/execute.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index d8452a666c..2544a2470c 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -2398,12 +2398,11 @@ void exec_status_dump(ExecStatus *s, FILE *f, const char *prefix) {
assert(s);
assert(f);
- if (!prefix)
- prefix = "";
-
if (s->pid <= 0)
return;
+ prefix = strempty(prefix);
+
fprintf(f,
"%sPID: "PID_FMT"\n",
prefix, s->pid);
@@ -2463,21 +2462,16 @@ char *exec_command_line(char **argv) {
}
void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix) {
- _cleanup_free_ char *p2 = NULL;
- const char *prefix2;
-
_cleanup_free_ char *cmd = NULL;
+ const char *prefix2;
assert(c);
assert(f);
- if (!prefix)
- prefix = "";
- p2 = strappend(prefix, "\t");
- prefix2 = p2 ? p2 : prefix;
+ prefix = strempty(prefix);
+ prefix2 = strappenda(prefix, "\t");
cmd = exec_command_line(c->argv);
-
fprintf(f,
"%sCommand Line: %s\n",
prefix, cmd ? cmd : strerror(ENOMEM));
@@ -2488,8 +2482,7 @@ void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix) {
void exec_command_dump_list(ExecCommand *c, FILE *f, const char *prefix) {
assert(f);
- if (!prefix)
- prefix = "";
+ prefix = strempty(prefix);
LIST_FOREACH(command, c, c)
exec_command_dump(c, f, prefix);