/* 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>
r = k;
}
- if (r < 0)
- log_error_errno(r, "Failed to write mode to /sys/power/disk: %m");
-
return r;
}
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;
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);
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);