diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-12-04 11:49:42 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-12-12 21:58:00 +0100 |
commit | 7a44c7e31fdeebce82189b134221297919104e7d (patch) | |
tree | 2b12fa18720523a3cace0a238ea78b719c1f7356 /src/shared/main-func.h | |
parent | generators: configure logging before the first use (diff) | |
download | systemd-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/shared/main-func.h')
-rw-r--r-- | src/shared/main-func.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/shared/main-func.h b/src/shared/main-func.h index ab6b272117..3c182e802b 100644 --- a/src/shared/main-func.h +++ b/src/shared/main-func.h @@ -9,10 +9,11 @@ #include "spawn-polkit-agent.h" #include "static-destruct.h" -#define _DEFINE_MAIN_FUNCTION(impl, ret) \ +#define _DEFINE_MAIN_FUNCTION(intro, impl, ret) \ int main(int argc, char *argv[]) { \ int r; \ - r = impl(argc, argv); \ + intro; \ + r = impl; \ static_destruct(); \ ask_password_agent_close(); \ polkit_agent_close(); \ @@ -24,10 +25,10 @@ /* Negative return values from impl are mapped to EXIT_FAILURE, and * everything else means success! */ #define DEFINE_MAIN_FUNCTION(impl) \ - _DEFINE_MAIN_FUNCTION(impl, r < 0 ? EXIT_FAILURE : EXIT_SUCCESS) + _DEFINE_MAIN_FUNCTION(,impl(argc, argv), r < 0 ? EXIT_FAILURE : EXIT_SUCCESS) /* Zero is mapped to EXIT_SUCCESS, negative values are mapped to EXIT_FAILURE, * and postive values are propagated. * Note: "true" means failure! */ #define DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(impl) \ - _DEFINE_MAIN_FUNCTION(impl, r < 0 ? EXIT_FAILURE : r) + _DEFINE_MAIN_FUNCTION(,impl(argc, argv), r < 0 ? EXIT_FAILURE : r) |