chiark / gitweb /
tree-wide: drop 'This file is part of systemd' blurb
[elogind.git] / src / sleep / sleep.c
index b958e5c6f9ab7c6c7a2bf222be6784d87062e614..bec4cb9302820fdb7414fabd4e36f5eac1b44194 100644 (file)
@@ -1,24 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1+ */
 /***
-  This file is part of systemd.
-
   Copyright 2012 Lennart Poettering
   Copyright 2013 Zbigniew JÄ™drzejewski-Szmek
   Copyright 2010-2017 Canonical
   Copyright 2018 Dell Inc.
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
 //#include <errno.h>
@@ -123,9 +108,6 @@ static int write_mode(char **modes) {
                         r = k;
         }
 
-        if (r < 0)
-                log_error_errno(r, "Failed to write mode to /sys/power/disk: %m");
-
         return r;
 }
 
@@ -147,7 +129,7 @@ static int write_state(FILE **f, char **states) {
                 fclose(*f);
                 *f = fopen("/sys/power/state", "we");
                 if (!*f)
-                        return log_error_errno(errno, "Failed to open /sys/power/state: %m");
+                        return -errno;
         }
 
         return r;
@@ -182,7 +164,7 @@ static int execute(char **modes, char **states) {
                         return log_error_errno(r, "Failed to write hibernation disk offset: %m");
                 r = write_mode(modes);
                 if (r < 0)
-                        return r;
+                        return log_error_errno(r, "Failed to write mode to /sys/power/disk: %m");;
         }
 
         execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments);
@@ -190,18 +172,16 @@ static int execute(char **modes, char **states) {
         log_struct(LOG_INFO,
                    "MESSAGE_ID=" SD_MESSAGE_SLEEP_START_STR,
                    LOG_MESSAGE("Suspending system..."),
-                   "SLEEP=%s", arg_verb,
-                   NULL);
+                   "SLEEP=%s", arg_verb);
 
         r = write_state(&f, states);
         if (r < 0)
-                return r;
+                return log_error_errno(r, "Failed to write /sys/power/state: %m");
 
         log_struct(LOG_INFO,
                    "MESSAGE_ID=" SD_MESSAGE_SLEEP_STOP_STR,
                    LOG_MESSAGE("System resumed."),
-                   "SLEEP=%s", arg_verb,
-                   NULL);
+                   "SLEEP=%s", arg_verb);
 
         arguments[1] = (char*) "post";
         execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments);