summaryrefslogtreecommitdiff
path: root/src/hibernate-resume
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-07-13 18:29:36 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-07-15 13:09:38 +0200
commitb8110a3eb8cb8a54626ee0ae440da83096f2b07d (patch)
treec282b013febe48a1ab44716175f0692409da10dd /src/hibernate-resume
parent78f8ce6d9086b93d6a806de7035c3826f22319c7 (diff)
downloadsystemd-b8110a3eb8cb8a54626ee0ae440da83096f2b07d.tar.gz
hibernate-resume-generator: use DEFINE_MAIN_GENERATOR_FUNCTION()
DEFINE_MAIN_GENERATOR_FUNCTION() always sets dest*, so there should be no change in behaviour.
Diffstat (limited to 'src/hibernate-resume')
-rw-r--r--src/hibernate-resume/hibernate-resume-generator.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/hibernate-resume/hibernate-resume-generator.c b/src/hibernate-resume/hibernate-resume-generator.c
index ee320909ee..f591407f78 100644
--- a/src/hibernate-resume/hibernate-resume-generator.c
+++ b/src/hibernate-resume/hibernate-resume-generator.c
@@ -16,7 +16,7 @@
#include "string-util.h"
#include "unit-name.h"
-static const char *arg_dest = "/tmp";
+static const char *arg_dest = NULL;
static char *arg_resume_device = NULL;
static char *arg_resume_options = NULL;
static char *arg_root_options = NULL;
@@ -109,17 +109,10 @@ static int process_resume(void) {
return 0;
}
-static int run(int argc, char *argv[]) {
+static int run(const char *dest, const char *dest_early, const char *dest_late) {
int r = 0;
- log_setup_generator();
-
- if (argc > 1 && argc != 4)
- return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
- "This program takes three or no arguments.");
-
- if (argc > 1)
- arg_dest = argv[1];
+ arg_dest = ASSERT_PTR(dest);
/* Don't even consider resuming outside of initramfs. */
if (!in_initrd()) {
@@ -139,4 +132,4 @@ static int run(int argc, char *argv[]) {
return process_resume();
}
-DEFINE_MAIN_FUNCTION(run);
+DEFINE_MAIN_GENERATOR_FUNCTION(run);