diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/boot/bless-boot-generator.c | 6 | ||||
-rw-r--r-- | src/cryptsetup/cryptsetup-generator.c | 5 | ||||
-rw-r--r-- | src/debug-generator/debug-generator.c | 6 | ||||
-rw-r--r-- | src/fstab-generator/fstab-generator.c | 5 | ||||
-rw-r--r-- | src/getty-generator/getty-generator.c | 6 | ||||
-rw-r--r-- | src/gpt-auto-generator/gpt-auto-generator.c | 5 | ||||
-rw-r--r-- | src/hibernate-resume/hibernate-resume-generator.c | 6 | ||||
-rw-r--r-- | src/rc-local-generator/rc-local-generator.c | 6 | ||||
-rw-r--r-- | src/shared/generator.c | 7 | ||||
-rw-r--r-- | src/shared/generator.h | 2 | ||||
-rw-r--r-- | src/system-update-generator/system-update-generator.c | 6 | ||||
-rw-r--r-- | src/sysv-generator/sysv-generator.c | 5 | ||||
-rw-r--r-- | src/veritysetup/veritysetup-generator.c | 5 |
13 files changed, 26 insertions, 44 deletions
diff --git a/src/boot/bless-boot-generator.c b/src/boot/bless-boot-generator.c index 139f65d25c..0fd9c76d19 100644 --- a/src/boot/bless-boot-generator.c +++ b/src/boot/bless-boot-generator.c @@ -5,6 +5,7 @@ #include <unistd.h> #include "efivars.h" +#include "generator.h" #include "log.h" #include "mkdir.h" #include "special.h" @@ -21,10 +22,7 @@ static const char *arg_dest = "/tmp"; int main(int argc, char *argv[]) { const char *p; - log_set_prohibit_ipc(true); - log_set_target(LOG_TARGET_AUTO); - log_parse_environment(); - log_open(); + log_setup_generator(); umask(0022); diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c index 85ace5379c..4ee77de8c3 100644 --- a/src/cryptsetup/cryptsetup-generator.c +++ b/src/cryptsetup/cryptsetup-generator.c @@ -583,10 +583,7 @@ int main(int argc, char *argv[]) { if (argc > 1) arg_dest = argv[1]; - log_set_prohibit_ipc(true); - log_set_target(LOG_TARGET_AUTO); - log_parse_environment(); - log_open(); + log_setup_generator(); umask(0022); diff --git a/src/debug-generator/debug-generator.c b/src/debug-generator/debug-generator.c index 73a8d35271..d90f2321a0 100644 --- a/src/debug-generator/debug-generator.c +++ b/src/debug-generator/debug-generator.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ #include "alloc-util.h" +#include "generator.h" #include "main-func.h" #include "mkdir.h" #include "parse-util.h" @@ -152,10 +153,7 @@ static int run(int argc, char *argv[]) { if (argc > 1) arg_dest = argv[2]; - log_set_prohibit_ipc(true); - log_set_target(LOG_TARGET_AUTO); - log_parse_environment(); - log_open(); + log_setup_generator(); umask(0022); diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index 482229b4a5..8225c1e869 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -870,10 +870,7 @@ int main(int argc, char *argv[]) { if (argc > 3) arg_dest_late = argv[3]; - log_set_prohibit_ipc(true); - log_set_target(LOG_TARGET_AUTO); - log_parse_environment(); - log_open(); + log_setup_generator(); umask(0022); diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c index 6af4c39137..8015154679 100644 --- a/src/getty-generator/getty-generator.c +++ b/src/getty-generator/getty-generator.c @@ -8,6 +8,7 @@ #include "alloc-util.h" #include "fd-util.h" #include "fileio.h" +#include "generator.h" #include "log.h" #include "mkdir.h" #include "path-util.h" @@ -120,10 +121,7 @@ int main(int argc, char *argv[]) { if (argc > 1) arg_dest = argv[1]; - log_set_prohibit_ipc(true); - log_set_target(LOG_TARGET_AUTO); - log_parse_environment(); - log_open(); + log_setup_generator(); umask(0022); diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c index f0d06ffacf..03942e94ea 100644 --- a/src/gpt-auto-generator/gpt-auto-generator.c +++ b/src/gpt-auto-generator/gpt-auto-generator.c @@ -679,10 +679,7 @@ int main(int argc, char *argv[]) { if (argc > 1) arg_dest = argv[3]; - log_set_prohibit_ipc(true); - log_set_target(LOG_TARGET_AUTO); - log_parse_environment(); - log_open(); + log_setup_generator(); umask(0022); diff --git a/src/hibernate-resume/hibernate-resume-generator.c b/src/hibernate-resume/hibernate-resume-generator.c index bfee2fde31..fd58720779 100644 --- a/src/hibernate-resume/hibernate-resume-generator.c +++ b/src/hibernate-resume/hibernate-resume-generator.c @@ -5,6 +5,7 @@ #include "alloc-util.h" #include "fstab-util.h" +#include "generator.h" #include "log.h" #include "mkdir.h" #include "proc-cmdline.h" @@ -68,10 +69,7 @@ static int process_resume(void) { int main(int argc, char *argv[]) { int r = 0; - log_set_prohibit_ipc(true); - log_set_target(LOG_TARGET_AUTO); - log_parse_environment(); - log_open(); + log_setup_generator(); umask(0022); diff --git a/src/rc-local-generator/rc-local-generator.c b/src/rc-local-generator/rc-local-generator.c index ba5e336a34..9135aca07e 100644 --- a/src/rc-local-generator/rc-local-generator.c +++ b/src/rc-local-generator/rc-local-generator.c @@ -4,6 +4,7 @@ #include <stdio.h> #include <unistd.h> +#include "generator.h" #include "log.h" #include "mkdir.h" #include "string-util.h" @@ -51,10 +52,7 @@ int main(int argc, char *argv[]) { if (argc > 1) arg_dest = argv[1]; - log_set_prohibit_ipc(true); - log_set_target(LOG_TARGET_AUTO); - log_parse_environment(); - log_open(); + log_setup_generator(); umask(0022); diff --git a/src/shared/generator.c b/src/shared/generator.c index 8d4fd3267b..53db27a93d 100644 --- a/src/shared/generator.c +++ b/src/shared/generator.c @@ -498,3 +498,10 @@ int generator_hook_up_growfs( return generator_add_symlink(dir, where_unit, "wants", unit); } + +void log_setup_generator(void) { + log_set_prohibit_ipc(true); + log_set_target(LOG_TARGET_AUTO); + log_parse_environment(); + log_open(); +} diff --git a/src/shared/generator.h b/src/shared/generator.h index f0a493b21e..f1a055401a 100644 --- a/src/shared/generator.h +++ b/src/shared/generator.h @@ -47,3 +47,5 @@ int generator_hook_up_growfs( const char *dir, const char *where, const char *target); + +void log_setup_generator(void); diff --git a/src/system-update-generator/system-update-generator.c b/src/system-update-generator/system-update-generator.c index 0f77042f48..4b7d7d58cd 100644 --- a/src/system-update-generator/system-update-generator.c +++ b/src/system-update-generator/system-update-generator.c @@ -4,6 +4,7 @@ #include <unistd.h> #include "fs-util.h" +#include "generator.h" #include "log.h" #include "proc-cmdline.h" #include "special.h" @@ -61,10 +62,7 @@ int main(int argc, char *argv[]) { if (argc > 1) arg_dest = argv[2]; - log_set_prohibit_ipc(true); - log_set_target(LOG_TARGET_AUTO); - log_parse_environment(); - log_open(); + log_setup_generator(); umask(0022); diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c index c92d7f841a..6a1badabd4 100644 --- a/src/sysv-generator/sysv-generator.c +++ b/src/sysv-generator/sysv-generator.c @@ -924,10 +924,7 @@ static int run(int argc, char *argv[]) { Iterator j; int r; - log_set_prohibit_ipc(true); - log_set_target(LOG_TARGET_AUTO); - log_parse_environment(); - log_open(); + log_setup_generator(); if (argc > 1 && argc != 4) { log_error("This program takes three or no arguments."); diff --git a/src/veritysetup/veritysetup-generator.c b/src/veritysetup/veritysetup-generator.c index 0c63c5eaad..b64d015559 100644 --- a/src/veritysetup/veritysetup-generator.c +++ b/src/veritysetup/veritysetup-generator.c @@ -210,10 +210,7 @@ int main(int argc, char *argv[]) { if (argc > 1) arg_dest = argv[1]; - log_set_prohibit_ipc(true); - log_set_target(LOG_TARGET_AUTO); - log_parse_environment(); - log_open(); + log_setup_generator(); umask(0022); |