aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2022-08-25 20:31:00 +0300
committerJoursoir <chat@joursoir.net>2022-08-25 20:37:37 +0300
commit6367ccb1572450b81524ddec477edb0d1fb8c103 (patch)
treeaea9474ffbe8f063e62fbd2ac2c40185166351cc /src
parent3837baa9648193cfa107846a5610955ffb2e39ca (diff)
downloadlock-password-6367ccb1572450b81524ddec477edb0d1fb8c103.tar.gz
lock-password-6367ccb1572450b81524ddec477edb0d1fb8c103.tar.bz2
lock-password-6367ccb1572450b81524ddec477edb0d1fb8c103.zip
routines: include wayland code only if DISPLAY isn't defined
This code is unreachable if lock-password is compiled with X11 support. Move it to `else` macro-statement.
Diffstat (limited to 'src')
-rw-r--r--src/routines.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/routines.c b/src/routines.c
index 696bedb..8ccf386 100644
--- a/src/routines.c
+++ b/src/routines.c
@@ -47,24 +47,24 @@ int copy_outside(char *password)
if(pid == 0) /* new process */
exit(run_clipboard(password));
return 0;
- #endif
+ #else
+ if(getenv("WAYLAND_DISPLAY") != NULL) {
+ char * const wl_copy[] = {"wl-copy", password, NULL};
+ int pid;
+ pid = fork();
+ if(pid == -1)
+ errprint_r(1, "Wayland fork() failed\n");
+ if(pid == 0) { /* new process */
+ execvp("wl-copy", wl_copy);
+ perror("wl-copy");
+ exit(1);
+ }
- if(getenv("WAYLAND_DISPLAY") != NULL) {
- char * const wl_copy[] = {"wl-copy", password, NULL};
- int pid;
- pid = fork();
- if(pid == -1)
- errprint_r(1, "Wayland fork() failed\n");
- if(pid == 0) { /* new process */
- execvp("wl-copy", wl_copy);
- perror("wl-copy");
- exit(1);
+ return 0;
}
- return 0;
- }
-
- errprint_r(1, "You didn't have x11 or wayland when app builded\n");
+ errprint_r(1, "You didn't have x11 or wayland when app builded\n");
+ #endif
}
int check_sneaky_paths(const char *path)