1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-06 13:17:44 +03:00

environment-d-generator: use DEFINE_MAIN_FUNCTION()

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2022-07-13 18:07:24 +02:00
parent 9cfc294fe0
commit 78f8ce6d90

View File

@ -8,6 +8,7 @@
#include "escape.h"
#include "glyph-util.h"
#include "log.h"
#include "main-func.h"
#include "path-lookup.h"
#include "strv.h"
@ -80,20 +81,19 @@ static int load_and_print(void) {
return 0;
}
int main(int argc, char *argv[]) {
static int run(int argc, char *argv[]) {
int r;
log_parse_environment();
log_open();
if (argc > 1) {
log_error("This program takes no arguments.");
return EXIT_FAILURE;
}
if (argc > 1)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "This program takes no arguments.");
r = load_and_print();
if (r < 0)
log_error_errno(r, "Failed to load environment.d: %m");
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
return log_error_errno(r, "Failed to load environment.d: %m");
return 0;
}
DEFINE_MAIN_FUNCTION(run);