summaryrefslogtreecommitdiff
path: root/src/execute.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-04 18:49:58 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-04 18:49:58 +0200
commitb58b41160fde88a82cba1ddec4be7dfb08825e35 (patch)
tree9f5b30cf50bcaf752fc955507c5d065d214e0222 /src/execute.c
parent14ad1d1437f51b8ebc8dc6e8d3707b41d48d0a3a (diff)
dbus: complete exec status coverage
Diffstat (limited to 'src/execute.c')
-rw-r--r--src/execute.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/execute.c b/src/execute.c
index 0bdd60000b..f3f95ff754 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -1281,8 +1281,7 @@ int exec_spawn(ExecCommand *command,
log_debug("Forked %s as %lu", command->path, (unsigned long) pid);
- command->exec_status.pid = pid;
- dual_timestamp_get(&command->exec_status.start_timestamp);
+ exec_status_start(&command->exec_status, pid);
*ret = pid;
return 0;
@@ -1561,9 +1560,21 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
}
}
-void exec_status_fill(ExecStatus *s, pid_t pid, int code, int status) {
+void exec_status_start(ExecStatus *s, pid_t pid) {
assert(s);
+ zero(*s);
+ s->pid = pid;
+ dual_timestamp_get(&s->start_timestamp);
+}
+
+void exec_status_exit(ExecStatus *s, pid_t pid, int code, int status) {
+ assert(s);
+
+ if ((s->pid && s->pid != pid) ||
+ !s->start_timestamp.realtime <= 0)
+ zero(*s);
+
s->pid = pid;
dual_timestamp_get(&s->exit_timestamp);