chiark / gitweb /
job: avoid recursion into transaction code from job cancelation
[elogind.git] / src / core / job.c
index 9614642f562e94ef41ef01046502200523c1f941..f08b8cbc7db3d6dfed8358926234cedb8128d05f 100644 (file)
@@ -180,7 +180,7 @@ Job* job_install(Job *j) {
 
         if (uj) {
                 if (j->type != JOB_NOP && job_type_is_conflicting(uj->type, j->type))
-                        job_finish_and_invalidate(uj, JOB_CANCELED, true);
+                        job_finish_and_invalidate(uj, JOB_CANCELED, false);
                 else {
                         /* not conflicting, i.e. mergeable */
 
@@ -687,6 +687,12 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
         assert(t >= 0);
         assert(t < _JOB_TYPE_MAX);
 
+        /* Skip this if it goes to the console. since we already print
+         * to the console anyway... */
+
+        if (log_on_console())
+                return;
+
         format = job_get_status_message_format_try_harder(u, t, result);
         if (!format)
                 return;
@@ -699,7 +705,7 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
 
                 mid = result == JOB_DONE ? SD_MESSAGE_UNIT_STARTED : SD_MESSAGE_UNIT_FAILED;
                 log_struct(result == JOB_DONE ? LOG_INFO : LOG_ERR,
-                           "MESSSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(mid),
+                           MESSAGE_ID(mid),
                            "UNIT=%s", u->id,
                            "RESULT=%s", job_result_to_string(result),
                            "MESSAGE=%s", buf,
@@ -707,7 +713,7 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
 
         } else if (t == JOB_STOP)
                 log_struct(result == JOB_DONE ? LOG_INFO : LOG_ERR,
-                           "MESSSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_UNIT_STOPPED),
+                           MESSAGE_ID(SD_MESSAGE_UNIT_STOPPED),
                            "UNIT=%s", u->id,
                            "RESULT=%s", job_result_to_string(result),
                            "MESSAGE=%s", buf,
@@ -715,7 +721,7 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
 
         else if (t == JOB_RELOAD)
                 log_struct(result == JOB_DONE ? LOG_INFO : LOG_ERR,
-                           "MESSSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_UNIT_RELOADED),
+                           MESSAGE_ID(SD_MESSAGE_UNIT_RELOADED),
                            "UNIT=%s", u->id,
                            "RESULT=%s", job_result_to_string(result),
                            "MESSAGE=%s", buf,