diff options
author | Joursoir <chat@joursoir.net> | 2022-08-25 20:31:00 +0300 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2022-08-25 20:37:37 +0300 |
commit | 6367ccb1572450b81524ddec477edb0d1fb8c103 (patch) | |
tree | aea9474ffbe8f063e62fbd2ac2c40185166351cc /src | |
parent | 3837baa9648193cfa107846a5610955ffb2e39ca (diff) | |
download | lock-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.c | 30 |
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) |