summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-03-10 23:41:24 -0500
committerDrew DeVault <sir@cmpwn.com>2017-03-10 23:41:24 -0500
commit595a19c3909b5d74d5b37c62674386fd1e8f4166 (patch)
tree39bb037a45fc7ab1847f58473b776dec0e191bad /main.c
parent9d0a38c3aaa54400e9b993c3aabb5892c607fc4b (diff)
UnGNUify the codebase
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/main.c b/main.c
index 49b24a3..9b33aab 100644
--- a/main.c
+++ b/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");