chiark / gitweb /
snapshot: return error when snapshot exists
[elogind.git] / src / core / manager.c
index 859631d3f6c6f2c1cb5da56f0a41d78ebbbdf564..ed7fdc71d704d55e432e4ee12f04cc12844131a8 100644 (file)
@@ -1189,15 +1189,11 @@ int manager_add_job(Manager *m, JobType type, Unit *unit, JobMode mode, bool ove
         assert(unit);
         assert(mode < _JOB_MODE_MAX);
 
-        if (mode == JOB_ISOLATE && type != JOB_START) {
-                sd_bus_error_setf(e, SD_BUS_ERROR_INVALID_ARGS, "Isolate is only valid for start.");
-                return -EINVAL;
-        }
+        if (mode == JOB_ISOLATE && type != JOB_START)
+                return sd_bus_error_setf(e, SD_BUS_ERROR_INVALID_ARGS, "Isolate is only valid for start.");
 
-        if (mode == JOB_ISOLATE && !unit->allow_isolate) {
-                sd_bus_error_setf(e, BUS_ERROR_NO_ISOLATION, "Operation refused, unit may not be isolated.");
-                return -EPERM;
-        }
+        if (mode == JOB_ISOLATE && !unit->allow_isolate)
+                return sd_bus_error_setf(e, BUS_ERROR_NO_ISOLATION, "Operation refused, unit may not be isolated.");
 
         log_debug_unit(unit->id,
                        "Trying to enqueue job %s/%s/%s", unit->id,
@@ -2944,7 +2940,7 @@ static bool manager_get_show_status(Manager *m, StatusType type) {
                 return false;
 
         /* If we cannot find out the status properly, just proceed. */
-        if (manager_check_ask_password(m) > 0)
+        if (type != STATUS_TYPE_EMERGENCY && manager_check_ask_password(m) > 0)
                 return false;
 
         if (m->show_status > 0)