Commit 06eb931f authored by Mario Limonciello's avatar Mario Limonciello Committed by Simon McVittie
Browse files

Import Debian changes 237-3ubuntu7

systemd (237-3ubuntu7) bionic; urgency=medium

  * Introduce suspend then hibernate (LP: #1756006)
parent b9240ff5
systemd (237-3ubuntu7) bionic; urgency=medium
* Introduce suspend then hibernate (LP: #1756006)
-- Mario Limonciello <mario.limonciello@dell.com> Mon, 02 Apr 2018 14:25:04 -0500
systemd (237-3ubuntu6) bionic; urgency=medium
* Adjust the new dropin test, for v237 systemd.
......
From 9aa2e409bcb70f3952b38a35f16fc080c22dd5a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 11 Mar 2018 09:13:03 +0100
Subject: [PATCH] shared/sleep-config: fix unitialized variable and use
STR_IN_SET (#8416)
---
src/shared/sleep-config.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
Index: systemd-237/src/shared/sleep-config.c
===================================================================
--- systemd-237.orig/src/shared/sleep-config.c
+++ systemd-237/src/shared/sleep-config.c
@@ -49,7 +49,7 @@ int parse_sleep_config(const char *verb,
**hibernate_mode = NULL, **hibernate_state = NULL,
**hybrid_mode = NULL, **hybrid_state = NULL;
char **modes, **states;
- usec_t delay;
+ usec_t delay = 180 * USEC_PER_MINUTE;
const ConfigTableItem items[] = {
{ "Sleep", "SuspendMode", config_parse_strv, 0, &suspend_mode },
@@ -97,13 +97,13 @@ int parse_sleep_config(const char *verb,
USE(states, hybrid_state);
else
states = strv_new("disk", NULL);
- } else if (streq(verb, "suspend-to-hibernate")) {
- if (delay == 0)
- delay = 180 * USEC_PER_MINUTE;
- } else
+
+ } else if (streq(verb, "suspend-to-hibernate"))
+ modes = states = NULL;
+ else
assert_not_reached("what verb");
- if ((!modes && (streq(verb, "hibernate") || streq(verb, "hybrid-sleep"))) ||
+ if ((!modes && STR_IN_SET(verb, "hibernate", "hybrid-sleep")) ||
(!states && !streq(verb, "suspend-to-hibernate"))) {
strv_free(modes);
strv_free(states);
@@ -306,10 +306,7 @@ int can_sleep(const char *verb) {
_cleanup_strv_free_ char **modes = NULL, **states = NULL;
int r;
- assert(streq(verb, "suspend") ||
- streq(verb, "hibernate") ||
- streq(verb, "hybrid-sleep") ||
- streq(verb, "suspend-to-hibernate"));
+ assert(STR_IN_SET(verb, "suspend", "hibernate", "hybrid-sleep", "suspend-to-hibernate"));
if (streq(verb, "suspend-to-hibernate"))
return can_s2h();
......@@ -51,3 +51,6 @@ debian/UBUNTU-test-test-functions-launch-qemu-with-vga-none.patch
debian/UBUNTU-core-use-setreuid-setregid-trick-to-create-session-k.patch
debian/UBUNTU-wait-online-exit-if-no-links-are-managed.patch
debian/UBUNTU-journald.service-set-Nice-1-to-dodge-watchdog-on-soft-loc.patch
debian/UBUNTU-Introduce-suspend-to-hibernate-8274.patch
debian/UBUNTU-shared-sleep-config-fix-unitialized-variable-and-use.patch
debian/UBUNTU-Rename-suspend-to-hibernate-to-suspend-then-hibernat.patch
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment