]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sleep: always thaw user.slice even if freezing failed
authormsizanoen1 <msizanoen@qtmlabs.xyz>
Wed, 7 Dec 2022 09:54:13 +0000 (16:54 +0700)
committermsizanoen1 <msizanoen@qtmlabs.xyz>
Wed, 7 Dec 2022 23:54:53 +0000 (00:54 +0100)
`FreezeUnit` can fail even when some units did got frozen, causing some
user units to be frozen. A possible symptom is `user@.service` being
frozen while still being able to log in over SSH.

src/sleep/sleep.c

index 6785ae2330af61f7ed090e4340c4edb8c7c8f81d..e74e334e3327461780871e4716635c9f5cf265cd 100644 (file)
@@ -374,7 +374,7 @@ static int freeze_thaw_user_slice(const char **method) {
 }
 
 static int execute_s2h(const SleepConfig *sleep_config) {
-        _unused_ _cleanup_(freeze_thaw_user_slice) const char *auto_method_thaw = NULL;
+        _unused_ _cleanup_(freeze_thaw_user_slice) const char *auto_method_thaw = "ThawUnit";
         int r, k;
 
         assert(sleep_config);
@@ -382,8 +382,6 @@ static int execute_s2h(const SleepConfig *sleep_config) {
         r = freeze_thaw_user_slice(&(const char*) { "FreezeUnit" });
         if (r < 0)
                 log_debug_errno(r, "Failed to freeze unit user.slice, ignoring: %m");
-        else
-                auto_method_thaw = "ThawUnit"; /* from now on we want automatic thawing */;
 
         r = check_wakeup_type();
         if (r < 0)