diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-04-21 12:39:28 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-04-21 12:45:49 +0200 |
commit | 4560d99e5ea4b9aa115ef96d48e173a4b6f9e82b (patch) | |
tree | 34ac3c84bd38e49d53c70da0de9dca34d24ba095 /src/sleep/sleep.c | |
parent | 67458536afcdceb25b63b8367837ab5402f3983e (diff) | |
download | systemd-4560d99e5ea4b9aa115ef96d48e173a4b6f9e82b.tar.gz |
tre-wide: use FORMAT_DEVNUM() a bit more
Diffstat (limited to 'src/sleep/sleep.c')
-rw-r--r-- | src/sleep/sleep.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c index f82a90dc1b..a8a451ee1a 100644 --- a/src/sleep/sleep.c +++ b/src/sleep/sleep.c @@ -23,6 +23,7 @@ #include "bus-locator.h" #include "bus-util.h" #include "constants.h" +#include "devnum-util.h" #include "exec-util.h" #include "fd-util.h" #include "fileio.h" @@ -45,13 +46,14 @@ static SleepOperation arg_operation = _SLEEP_OPERATION_INVALID; static int write_hibernate_location_info(const HibernateLocation *hibernate_location) { char offset_str[DECIMAL_STR_MAX(uint64_t)]; - char resume_str[DECIMAL_STR_MAX(unsigned) * 2 + STRLEN(":")]; + const char *resume_str; int r; assert(hibernate_location); assert(hibernate_location->swap); - xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno)); + resume_str = FORMAT_DEVNUM(hibernate_location->devno); + r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER); if (r < 0) return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m", |