From 36fcac2cf7efe0164cce7d7674b6d13ddb14bb4b Mon Sep 17 00:00:00 2001 From: Sven Eden Date: Wed, 28 Jun 2017 10:48:10 +0200 Subject: [PATCH] Prep v231.2: Minor changes to make future patching easier. --- src/login/logind-action.c | 9 +++++++++ src/login/logind-user.c | 6 +++++- src/update-utmp/update-utmp.c | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/login/logind-action.c b/src/login/logind-action.c index 82c061d62..bcf7b86a3 100644 --- a/src/login/logind-action.c +++ b/src/login/logind-action.c @@ -111,12 +111,21 @@ int manager_handle_action( 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; +#endif // 0 else if (handle == HANDLE_KEXEC) supported = access(KEXEC, X_OK) >= 0; else diff --git a/src/login/logind-user.c b/src/login/logind-user.c index f24dd618f..171a4a670 100644 --- a/src/login/logind-user.c +++ b/src/login/logind-user.c @@ -49,6 +49,10 @@ #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]; @@ -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; - r = slice_build_subslice("user.slice", lu, &u->slice); + r = slice_build_subslice(SPECIAL_USER_SLICE, lu, &u->slice); if (r < 0) return r; diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c index af1665733..9f0217250 100644 --- a/src/update-utmp/update-utmp.c +++ b/src/update-utmp/update-utmp.c @@ -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; } + return t; } -- 2.30.2