summaryrefslogtreecommitdiffstats
path: root/src/veritysetup
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-12-04 11:49:42 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-12-12 21:58:00 +0100
commit7a44c7e31fdeebce82189b134221297919104e7d (patch)
tree2b12fa18720523a3cace0a238ea78b719c1f7356 /src/veritysetup
parentgenerators: configure logging before the first use (diff)
downloadsystemd-7a44c7e31fdeebce82189b134221297919104e7d.tar.xz
systemd-7a44c7e31fdeebce82189b134221297919104e7d.zip
generators: define custom main func definer and use it where applicable
There should be no functional difference, except that the error message is changd from "three or no arguments" to "zero or three arguments". Somehow the inverted form always seemed strange. umask() call is also dropped from run-generator. I think it wasn't dropped in 053254e3cb215df3b8c905bc39b920f8817e1c7d because the run generator was merged around the same time.
Diffstat (limited to 'src/veritysetup')
-rw-r--r--src/veritysetup/veritysetup-generator.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/veritysetup/veritysetup-generator.c b/src/veritysetup/veritysetup-generator.c
index 51996ec37e..65a4e7b0fd 100644
--- a/src/veritysetup/veritysetup-generator.c
+++ b/src/veritysetup/veritysetup-generator.c
@@ -204,16 +204,10 @@ static int determine_devices(void) {
return 1;
}
-static int run(int argc, char *argv[]) {
+static int run(const char *dest, const char *dest_early, const char *dest_late) {
int r;
- 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];
+ assert_se(arg_dest = dest);
r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_STRIP_RD_PREFIX);
if (r < 0)
@@ -229,11 +223,7 @@ static int run(int argc, char *argv[]) {
if (r < 0)
return r;
- r = create_device();
- if (r < 0)
- return r;
-
- return 0;
+ return create_device();
}
-DEFINE_MAIN_FUNCTION(run);
+DEFINE_MAIN_GENERATOR_FUNCTION(run);