summaryrefslogtreecommitdiff
path: root/src/job.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-03-08 01:43:41 +0100
committerLennart Poettering <lennart@poettering.net>2011-03-08 01:53:47 +0100
commit81253930180bac6b6fb372a9c7bea724bd795c86 (patch)
tree8261ef735745cd499910906134008ac2aba730e8 /src/job.c
parent85f0c93a50c14cebf0be2740de64c14f27ac61b3 (diff)
job: convert job type as early as we can, to simplify things a bit
Diffstat (limited to 'src/job.c')
-rw-r--r--src/job.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/job.c b/src/job.c
index 54bd4147e2..206490ffbb 100644
--- a/src/job.c
+++ b/src/job.c
@@ -422,10 +422,16 @@ int job_run_and_invalidate(Job *j) {
break;
case JOB_RELOAD_OR_START:
- if (unit_active_state(j->unit) == UNIT_ACTIVE)
+ if (unit_active_state(j->unit) == UNIT_ACTIVE) {
+ j->type = JOB_RELOAD;
r = unit_reload(j->unit);
- else
+ } else {
+ j->type = JOB_START;
r = unit_start(j->unit);
+
+ if (r == -EBADR)
+ r = 0;
+ }
break;
case JOB_RESTART: {
@@ -445,8 +451,10 @@ int job_run_and_invalidate(Job *j) {
else if (t == UNIT_ACTIVATING) {
j->type = JOB_START;
r = unit_start(j->unit);
- } else
+ } else {
+ j->type = JOB_RESTART;
r = unit_stop(j->unit);
+ }
break;
}