int main(int argc, char *argv[]) { int r = 0; if (argc > 1 && argc != 4) { log_error("This program takes three or no arguments."); return EXIT_FAILURE; } if (argc > 1) arg_dest = argv[1]; log_set_prohibit_ipc(true); log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); umask(0022); /* Don't even consider resuming outside of initramfs. */ if (!in_initrd()) return EXIT_SUCCESS; r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0); if (r < 0) log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); r = process_resume(); free(arg_resume_device); return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; }
int main(int argc, char *argv[]) { int r, k; if (argc > 1 && argc != 4) { log_error("This program takes three or no arguments."); return EXIT_FAILURE; } if (argc > 1) arg_dest = argv[2]; log_set_target(LOG_TARGET_SAFE); log_parse_environment(); log_open(); umask(0022); r = generate_symlink(); if (r > 0) { k = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0); if (k < 0) log_warning_errno(k, "Failed to parse kernel command line, ignoring: %m"); } return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; }
int main(int argc, char *argv[]) { static const char * const cmdline[] = { QUOTACHECK, "-anug", NULL }; pid_t pid; int r; if (argc > 1) { log_error("This program takes no arguments."); return EXIT_FAILURE; } log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); umask(0022); r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0); if (r < 0) log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); test_files(); if (!arg_force) { if (arg_skip) return EXIT_SUCCESS; if (access("/run/systemd/quotacheck", F_OK) < 0) return EXIT_SUCCESS; } pid = fork(); if (pid < 0) { r = log_error_errno(errno, "fork(): %m"); goto finish; } if (pid == 0) { /* Child */ (void) reset_all_signal_handlers(); (void) reset_signal_mask(); assert_se(prctl(PR_SET_PDEATHSIG, SIGTERM) == 0); execv(cmdline[0], (char**) cmdline); _exit(1); /* Operational error */ } r = wait_for_terminate_and_warn("quotacheck", pid, true); finish: return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; }
int main(int argc, char *argv[]) { int r; if (argc > 1) { log_error("This program takes no arguments."); return EXIT_FAILURE; } log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); umask(0022); r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0); if (r < 0) log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); test_files(); if (!arg_force) { if (arg_skip) return EXIT_SUCCESS; if (access("/run/systemd/quotacheck", F_OK) < 0) return EXIT_SUCCESS; } r = safe_fork("(quotacheck)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG|FORK_WAIT, NULL); if (r < 0) goto finish; if (r == 0) { static const char * const cmdline[] = { QUOTACHECK, "-anug", NULL }; /* Child */ execv(cmdline[0], (char**) cmdline); _exit(EXIT_FAILURE); /* Operational error */ } finish: return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; }
static int run(const char *dest, const char *dest_early, const char *dest_late) { int r; assert_se(arg_dest = dest); r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_STRIP_RD_PREFIX); if (r < 0) return log_warning_errno(r, "Failed to parse kernel command line: %m"); /* For now we only support the root device on verity. Later on we might want to add support for /etc/veritytab * or similar to define additional mappings */ if (!arg_enabled) return 0; r = determine_devices(); if (r < 0) return r; return create_device(); }