]> err.no Git - systemd/commitdiff
unit: signal explicitly if a condition failed in unit_start()
authorLennart Poettering <lennart@poettering.net>
Fri, 13 Apr 2012 17:04:38 +0000 (19:04 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 13 Apr 2012 17:46:51 +0000 (19:46 +0200)
We shouldn't print a status message on the console if we skipped a unit
due to a condition. Hence make unit_start() return -ENOEXEC in such a
case which is mapped to JOB_SKIPPED which results in no console message.

src/core/job.c

index 781f83e175cf05900b405f59502b699bdb42cd51..f3c76d66b59dd85f1acd7948ca290c8ef7c9d0d3 100644 (file)
@@ -417,7 +417,8 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
                 switch (result) {
 
                 case JOB_DONE:
-                        unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON "  OK  " ANSI_HIGHLIGHT_OFF, "Started %s", unit_description(u));
+                        if (u->condition_result)
+                                unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON "  OK  " ANSI_HIGHLIGHT_OFF, "Started %s", unit_description(u));
                         break;
 
                 case JOB_FAILED: