-/*-*- Mode: C; c-basic-offset: 8 -*-*/
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
assert(type < _JOB_TYPE_MAX);
assert(unit);
- if (type != JOB_STOP &&
- unit->meta.load_state != UNIT_LOADED) {
- dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s failed to load. See logs for details.", unit->meta.id);
+ if (unit->meta.load_state != UNIT_LOADED && unit->meta.load_state != UNIT_FAILED) {
+ dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s is not loaded properly.", unit->meta.id);
+ return -EINVAL;
+ }
+
+ if (type != JOB_STOP && unit->meta.load_state == UNIT_FAILED) {
+ dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s failed to load: %s. You might find more information in the logs.",
+ unit->meta.id,
+ strerror(-unit->meta.load_error));
return -EINVAL;
}
if (n >= 0)
return -EIO;
- if (errno == EAGAIN)
+ if (errno == EAGAIN || errno == EINTR)
break;
return -errno;
if (m->audit_fd < 0)
return;
+ /* Don't generate audit events if the service was already
+ * started and we're just deserializing */
+ if (m->n_deserializing > 0)
+ return;
+
if (!(p = unit_name_to_prefix_and_instance(u->meta.id))) {
log_error("Failed to allocate unit name for audit message: %s", strerror(ENOMEM));
return;