mirror of
https://github.com/systemd/systemd.git
synced 2025-01-18 10:04:04 +03:00
7a44c7e31f
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.
35 lines
1.6 KiB
C
35 lines
1.6 KiB
C
/* SPDX-License-Identifier: LGPL-2.1+ */
|
|
#pragma once
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "pager.h"
|
|
#include "selinux-util.h"
|
|
#include "spawn-ask-password-agent.h"
|
|
#include "spawn-polkit-agent.h"
|
|
#include "static-destruct.h"
|
|
|
|
#define _DEFINE_MAIN_FUNCTION(intro, impl, ret) \
|
|
int main(int argc, char *argv[]) { \
|
|
int r; \
|
|
intro; \
|
|
r = impl; \
|
|
static_destruct(); \
|
|
ask_password_agent_close(); \
|
|
polkit_agent_close(); \
|
|
mac_selinux_finish(); \
|
|
pager_close(); \
|
|
return ret; \
|
|
}
|
|
|
|
/* Negative return values from impl are mapped to EXIT_FAILURE, and
|
|
* everything else means success! */
|
|
#define DEFINE_MAIN_FUNCTION(impl) \
|
|
_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(argc, argv), r < 0 ? EXIT_FAILURE : r)
|