if (u->job)
return true;
+ if (u->nop_job)
+ return true;
+
if (unit_active_state(u) != UNIT_INACTIVE)
return true;
job_free(j);
}
+ if (u->nop_job) {
+ Job *j = u->nop_job;
+ job_uninstall(j);
+ job_free(j);
+ }
+
for (d = 0; d < _UNIT_DEPENDENCY_MAX; d++)
bidi_set_free(u, u->dependencies[d]);
if (other->job)
return -EEXIST;
+ if (other->nop_job)
+ return -EEXIST;
+
if (!UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(other)))
return -EEXIST;
if (u->job)
job_dump(u->job, f, prefix2);
+ if (u->nop_job)
+ job_dump(u->nop_job, f, prefix2);
+
free(p2);
}
case JOB_VERIFY_ACTIVE:
case JOB_START:
case JOB_STOP:
+ case JOB_NOP:
return true;
case JOB_RESTART:
job_serialize(u->job, f, fds);
}
+ if (u->nop_job) {
+ fprintf(f, "job\n");
+ job_serialize(u->nop_job, f, fds);
+ }
+
dual_timestamp_serialize(f, "inactive-exit-timestamp", &u->inactive_exit_timestamp);
dual_timestamp_serialize(f, "active-enter-timestamp", &u->active_enter_timestamp);
dual_timestamp_serialize(f, "active-exit-timestamp", &u->active_exit_timestamp);
return r;
}
- job_install_deserialized(j);
r = hashmap_put(u->manager->jobs, UINT32_TO_PTR(j->id), j);
if (r < 0) {
job_free(j);
return r;
}
+
+ r = job_install_deserialized(j);
+ if (r < 0) {
+ hashmap_remove(u->manager->jobs, UINT32_TO_PTR(j->id));
+ job_free(j);
+ return r;
+ }
} else {
/* legacy */
JobType type = job_type_from_string(v);