aboutsummaryrefslogtreecommitdiff
path: root/swaylock
diff options
context:
space:
mode:
authorZandr Martin <zandrmartin@gmail.com>2017-03-13 07:35:12 -0400
committerZandr Martin <zandrmartin@gmail.com>2017-03-13 07:35:12 -0400
commitb507462d1c66e11cce76e069a508621dc9599f07 (patch)
tree52cc52fb0ec42085c37bee5f4f2e5c5f10cf2631 /swaylock
parent18450dd16a3909d0ea581f5f9cad4128751870cc (diff)
parent2e1083f52cbec40ed00df27dd1fb5b4d42d9254b (diff)
downloadsway-b507462d1c66e11cce76e069a508621dc9599f07.tar.xz
Merge branch 'master' of git://github.com/SirCmpwn/sway into new-command-aliases
Diffstat (limited to 'swaylock')
-rw-r--r--swaylock/main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/swaylock/main.c b/swaylock/main.c
index 49b24a3a..9b33aab9 100644
--- a/swaylock/main.c
+++ b/swaylock/main.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 500
#include "wayland-swaylock-client-protocol.h"
#include <xkbcommon/xkbcommon.h>
#include <xkbcommon/xkbcommon-names.h>
@@ -460,12 +461,16 @@ int main(int argc, char **argv) {
case 'u':
show_indicator = false;
break;
- case 'f':
- if (daemon(0, 0) != 0) {
+ case 'f': {
+ pid_t t = fork();
+ if (t == -1) {
sway_log(L_ERROR, "daemon call failed");
exit(EXIT_FAILURE);
+ } else if (t > 0) {
+ exit(0);
}
break;
+ }
case 'r':
if (line_source != LINE_SOURCE_DEFAULT) {
sway_log(L_ERROR, "line source options conflict");