summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichal Sekletar <msekleta@redhat.com>2015-12-04 21:33:42 +0100
committerMichal Sekletar <msekleta@redhat.com>2015-12-04 22:01:17 +0100
commitea4e6292af593b3b631560ac5139ad1f7442d881 (patch)
tree6f34241bd18cb1fb67e38644eee6da7555e261b1 /src
parent8eb3655cdb1910537615bb69c5ecf90dcc9d81c3 (diff)
user-sessions: make sure /run/nologin has correct SELinux label
Diffstat (limited to 'src')
-rw-r--r--src/user-sessions/user-sessions.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/user-sessions/user-sessions.c b/src/user-sessions/user-sessions.c
index 252cbdb26c..d28b196c4e 100644
--- a/src/user-sessions/user-sessions.c
+++ b/src/user-sessions/user-sessions.c
@@ -23,7 +23,9 @@
#include <unistd.h>
#include "fileio.h"
+#include "fileio-label.h"
#include "log.h"
+#include "selinux-util.h"
#include "string-util.h"
#include "util.h"
@@ -40,6 +42,8 @@ int main(int argc, char*argv[]) {
umask(0022);
+ mac_selinux_init(NULL);
+
if (streq(argv[1], "start")) {
int r = 0;
@@ -65,7 +69,7 @@ int main(int argc, char*argv[]) {
} else if (streq(argv[1], "stop")) {
int r;
- r = write_string_file("/run/nologin", "System is going down.", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC);
+ r = write_string_file_atomic_label("/run/nologin", "System is going down.");
if (r < 0) {
log_error_errno(r, "Failed to create /run/nologin: %m");
return EXIT_FAILURE;
@@ -76,5 +80,7 @@ int main(int argc, char*argv[]) {
return EXIT_FAILURE;
}
+ mac_selinux_finish();
+
return EXIT_SUCCESS;
}