mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-24 21:34:08 +03:00
generators: configure logging before the first use
This commit is contained in:
parent
f7e81fd96f
commit
aba311f7ff
@ -583,14 +583,14 @@ DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(crypt_device_hash_ops, char, strin
|
|||||||
static int run(int argc, char *argv[]) {
|
static int run(int argc, char *argv[]) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
log_setup_generator();
|
||||||
|
|
||||||
if (argc > 1 && argc != 4)
|
if (argc > 1 && argc != 4)
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "This program takes three or no arguments.");
|
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "This program takes three or no arguments.");
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
arg_dest = argv[1];
|
arg_dest = argv[1];
|
||||||
|
|
||||||
log_setup_generator();
|
|
||||||
|
|
||||||
arg_disks = hashmap_new(&crypt_device_hash_ops);
|
arg_disks = hashmap_new(&crypt_device_hash_ops);
|
||||||
if (!arg_disks)
|
if (!arg_disks)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
@ -145,6 +145,8 @@ static int generate_wants_symlinks(void) {
|
|||||||
static int run(int argc, char *argv[]) {
|
static int run(int argc, char *argv[]) {
|
||||||
int r, q;
|
int r, q;
|
||||||
|
|
||||||
|
log_setup_generator();
|
||||||
|
|
||||||
if (argc > 1 && argc != 4)
|
if (argc > 1 && argc != 4)
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||||
"This program takes three or no arguments.");
|
"This program takes three or no arguments.");
|
||||||
@ -152,8 +154,6 @@ static int run(int argc, char *argv[]) {
|
|||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
arg_dest = argv[2];
|
arg_dest = argv[2];
|
||||||
|
|
||||||
log_setup_generator();
|
|
||||||
|
|
||||||
r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_RD_STRICT | PROC_CMDLINE_STRIP_RD_PREFIX);
|
r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_RD_STRICT | PROC_CMDLINE_STRIP_RD_PREFIX);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
|
log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
|
||||||
|
@ -871,6 +871,8 @@ static int determine_root(void) {
|
|||||||
static int run(int argc, char *argv[]) {
|
static int run(int argc, char *argv[]) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
log_setup_generator();
|
||||||
|
|
||||||
if (argc > 1 && argc != 4)
|
if (argc > 1 && argc != 4)
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||||
"This program takes three or no arguments.");
|
"This program takes three or no arguments.");
|
||||||
@ -880,8 +882,6 @@ static int run(int argc, char *argv[]) {
|
|||||||
if (argc > 3)
|
if (argc > 3)
|
||||||
arg_dest_late = argv[3];
|
arg_dest_late = argv[3];
|
||||||
|
|
||||||
log_setup_generator();
|
|
||||||
|
|
||||||
r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0);
|
r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
|
log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
|
||||||
|
@ -113,6 +113,8 @@ int main(int argc, char *argv[]) {
|
|||||||
const char *j;
|
const char *j;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
log_setup_generator();
|
||||||
|
|
||||||
if (argc > 1 && argc != 4) {
|
if (argc > 1 && argc != 4) {
|
||||||
log_error("This program takes three or no arguments.");
|
log_error("This program takes three or no arguments.");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
@ -121,8 +123,6 @@ int main(int argc, char *argv[]) {
|
|||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
arg_dest = argv[1];
|
arg_dest = argv[1];
|
||||||
|
|
||||||
log_setup_generator();
|
|
||||||
|
|
||||||
if (detect_container() > 0) {
|
if (detect_container() > 0) {
|
||||||
_cleanup_free_ char *container_ttys = NULL;
|
_cleanup_free_ char *container_ttys = NULL;
|
||||||
|
|
||||||
|
@ -671,6 +671,8 @@ static int add_mounts(void) {
|
|||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
int r, k;
|
int r, k;
|
||||||
|
|
||||||
|
log_setup_generator();
|
||||||
|
|
||||||
if (argc > 1 && argc != 4) {
|
if (argc > 1 && argc != 4) {
|
||||||
log_error("This program takes three or no arguments.");
|
log_error("This program takes three or no arguments.");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
@ -679,8 +681,6 @@ int main(int argc, char *argv[]) {
|
|||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
arg_dest = argv[3];
|
arg_dest = argv[3];
|
||||||
|
|
||||||
log_setup_generator();
|
|
||||||
|
|
||||||
if (detect_container() > 0) {
|
if (detect_container() > 0) {
|
||||||
log_debug("In a container, exiting.");
|
log_debug("In a container, exiting.");
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
@ -54,6 +54,8 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
|
|||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
int r, k;
|
int r, k;
|
||||||
|
|
||||||
|
log_setup_generator();
|
||||||
|
|
||||||
if (argc > 1 && argc != 4) {
|
if (argc > 1 && argc != 4) {
|
||||||
log_error("This program takes three or no arguments.");
|
log_error("This program takes three or no arguments.");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
@ -62,8 +64,6 @@ int main(int argc, char *argv[]) {
|
|||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
arg_dest = argv[2];
|
arg_dest = argv[2];
|
||||||
|
|
||||||
log_setup_generator();
|
|
||||||
|
|
||||||
r = generate_symlink();
|
r = generate_symlink();
|
||||||
|
|
||||||
if (r > 0) {
|
if (r > 0) {
|
||||||
|
@ -207,14 +207,14 @@ static int determine_devices(void) {
|
|||||||
static int run(int argc, char *argv[]) {
|
static int run(int argc, char *argv[]) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
log_setup_generator();
|
||||||
|
|
||||||
if (argc > 1 && argc != 4)
|
if (argc > 1 && argc != 4)
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "This program takes three or no arguments.");
|
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "This program takes three or no arguments.");
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
arg_dest = argv[1];
|
arg_dest = argv[1];
|
||||||
|
|
||||||
log_setup_generator();
|
|
||||||
|
|
||||||
r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_STRIP_RD_PREFIX);
|
r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_STRIP_RD_PREFIX);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_warning_errno(r, "Failed to parse kernel command line: %m");
|
return log_warning_errno(r, "Failed to parse kernel command line: %m");
|
||||||
|
Loading…
Reference in New Issue
Block a user