summaryrefslogtreecommitdiff
path: root/swaylock/main.c
diff options
context:
space:
mode:
authoremersion <[email protected]>2018-04-13 09:14:37 -0400
committerGitHub <[email protected]>2018-04-13 09:14:37 -0400
commit2b34bf1882f24ebd8c87debb2e2223bc084736c3 (patch)
treeb27acb8f604bf5fc5cc39b927d3e62d748cf7313 /swaylock/main.c
parentde65d05821d5eaae6525e86363c76aaa395346fb (diff)
parenta5735c08c7c3d99c452ea87a591afef0f4c2f5d2 (diff)
Merge branch 'master' into crashes
Diffstat (limited to 'swaylock/main.c')
-rw-r--r--swaylock/main.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/swaylock/main.c b/swaylock/main.c
index 4c6b44c6..200c1b5f 100644
--- a/swaylock/main.c
+++ b/swaylock/main.c
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/mman.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
@@ -18,10 +19,15 @@
#include "background-image.h"
#include "pool-buffer.h"
#include "cairo.h"
+#include "log.h"
#include "util.h"
#include "wlr-input-inhibitor-unstable-v1-client-protocol.h"
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
+void sway_terminate(int exit_code) {
+ exit(exit_code);
+}
+
static void daemonize() {
int fds[2];
if (pipe(fds) != 0) {
@@ -236,6 +242,13 @@ int main(int argc, char **argv) {
}
}
+#ifdef __linux__
+ // Most non-linux platforms require root to mlock()
+ if (mlock(state.password.buffer, sizeof(state.password.buffer)) != 0) {
+ sway_abort("Unable to mlock() password memory.");
+ }
+#endif
+
wl_list_init(&state.surfaces);
state.xkb.context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
state.display = wl_display_connect(NULL);