chiark / gitweb /
Prep v231.2: Minor changes to make future patching easier.
authorSven Eden <yamakuzure@gmx.net>
Wed, 28 Jun 2017 08:48:10 +0000 (10:48 +0200)
committerSven Eden <yamakuzure@gmx.net>
Wed, 28 Jun 2017 08:48:10 +0000 (10:48 +0200)
src/login/logind-action.c
src/login/logind-user.c
src/update-utmp/update-utmp.c

index 82c061d62677b6907942391fbaddfde9d3060461..bcf7b86a3b1d205bd259072345a077cab9464dce 100644 (file)
@@ -111,12 +111,21 @@ int manager_handle_action(
                 return 1;
         }
 
                 return 1;
         }
 
+#if 0 /// elogind needs its own can_sleep() variant.
+        if (handle == HANDLE_SUSPEND)
+                supported = can_sleep("suspend") > 0;
+        else if (handle == HANDLE_HIBERNATE)
+                supported = can_sleep("hibernate") > 0;
+        else if (handle == HANDLE_HYBRID_SLEEP)
+                supported = can_sleep("hybrid-sleep") > 0;
+#else
         if (handle == HANDLE_SUSPEND)
                 supported = can_sleep(m, "suspend") > 0;
         else if (handle == HANDLE_HIBERNATE)
                 supported = can_sleep(m, "hibernate") > 0;
         else if (handle == HANDLE_HYBRID_SLEEP)
                 supported = can_sleep(m, "hybrid-sleep") > 0;
         if (handle == HANDLE_SUSPEND)
                 supported = can_sleep(m, "suspend") > 0;
         else if (handle == HANDLE_HIBERNATE)
                 supported = can_sleep(m, "hibernate") > 0;
         else if (handle == HANDLE_HYBRID_SLEEP)
                 supported = can_sleep(m, "hybrid-sleep") > 0;
+#endif // 0
         else if (handle == HANDLE_KEXEC)
                 supported = access(KEXEC, X_OK) >= 0;
         else
         else if (handle == HANDLE_KEXEC)
                 supported = access(KEXEC, X_OK) >= 0;
         else
index f24dd618f3263b24dd6884bb0c4a57d604d32ca7..171a4a670e7222530bce43830a6f0cdd95b5f6a1 100644 (file)
 #include "user-util.h"
 #include "util.h"
 
 #include "user-util.h"
 #include "util.h"
 
+#if 1 /// elogind uses a static value here
+#  define SPECIAL_USER_SLICE "user.slice"
+#endif // 1
+
 int user_new(User **out, Manager *m, uid_t uid, gid_t gid, const char *name) {
         _cleanup_(user_freep) User *u = NULL;
         char lu[DECIMAL_STR_MAX(uid_t) + 1];
 int user_new(User **out, Manager *m, uid_t uid, gid_t gid, const char *name) {
         _cleanup_(user_freep) User *u = NULL;
         char lu[DECIMAL_STR_MAX(uid_t) + 1];
@@ -77,7 +81,7 @@ int user_new(User **out, Manager *m, uid_t uid, gid_t gid, const char *name) {
         if (asprintf(&u->runtime_path, "/run/user/"UID_FMT, uid) < 0)
                 return -ENOMEM;
 
         if (asprintf(&u->runtime_path, "/run/user/"UID_FMT, uid) < 0)
                 return -ENOMEM;
 
-        r = slice_build_subslice("user.slice", lu, &u->slice);
+        r = slice_build_subslice(SPECIAL_USER_SLICE, lu, &u->slice);
         if (r < 0)
                 return r;
 
         if (r < 0)
                 return r;
 
index af1665733f68fe852c7825a0cb735d353264ab1c..9f021725001d2c40190ae0c99969de9d2933eb0a 100644 (file)
@@ -69,6 +69,7 @@ static usec_t get_startup_time(Context *c) {
                 log_error_errno(r, "Failed to get timestamp: %s", bus_error_message(&error, r));
                 return 0;
         }
                 log_error_errno(r, "Failed to get timestamp: %s", bus_error_message(&error, r));
                 return 0;
         }
+
         return t;
 }
 
         return t;
 }