summaryrefslogtreecommitdiffstats
path: root/src/user-sessions
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-11-20 16:40:49 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-11-21 09:14:00 +0100
commit8d38b8ad56c74782a986e86ddbd2f7b652d661c6 (patch)
tree9c3c3f4bb50c77dec83172f4d38bf3725ecece33 /src/user-sessions
parentsystemctl: define main through macro and call ask_password_agent_close() from... (diff)
downloadsystemd-8d38b8ad56c74782a986e86ddbd2f7b652d661c6.tar.xz
systemd-8d38b8ad56c74782a986e86ddbd2f7b652d661c6.zip
Call mac_selinux_close() from main func macros, convert user-sessions and test-udev
Diffstat (limited to 'src/user-sessions')
-rw-r--r--src/user-sessions/user-sessions.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/user-sessions/user-sessions.c b/src/user-sessions/user-sessions.c
index fa0829e384..4f711c2ed6 100644
--- a/src/user-sessions/user-sessions.c
+++ b/src/user-sessions/user-sessions.c
@@ -6,17 +6,18 @@
#include "fileio.h"
#include "fileio-label.h"
#include "fs-util.h"
+#include "main-func.h"
#include "log.h"
#include "selinux-util.h"
#include "string-util.h"
#include "util.h"
-int main(int argc, char*argv[]) {
+static int run(int argc, char*argv[]) {
int r, k;
if (argc != 2) {
log_error("This program requires one argument.");
- return EXIT_FAILURE;
+ return -EINVAL;
}
log_setup_service();
@@ -28,16 +29,15 @@ int main(int argc, char*argv[]) {
if (streq(argv[1], "start")) {
r = unlink_or_warn("/run/nologin");
k = unlink_or_warn("/etc/nologin");
- if (k < 0 && r >= 0)
- r = k;
+ if (r < 0)
+ return r;
+ return k;
} else if (streq(argv[1], "stop"))
- r = create_shutdown_run_nologin_or_warn();
- else {
- log_error("Unknown verb '%s'.", argv[1]);
- r = -EINVAL;
- }
+ return create_shutdown_run_nologin_or_warn();
- mac_selinux_finish();
- return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
+ log_error("Unknown verb '%s'.", argv[1]);
+ return -EINVAL;
}
+
+DEFINE_MAIN_FUNCTION(run);