From 6367ccb1572450b81524ddec477edb0d1fb8c103 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Thu, 25 Aug 2022 20:31:00 +0300 Subject: 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. --- src/routines.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/routines.c') 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) -- cgit v1.2.3-18-g5258