From 85b4b0d67cc69a2b9440091f9634f2fa04b7ffea Mon Sep 17 00:00:00 2001 From: Joursoir Date: Fri, 26 Aug 2022 14:34:00 +0300 Subject: routines: replace errprint_*() with print_error() This is one of the steps on the way to get rid of errprint_*() macros and handle errors by yourself. For more context see other patches under the same topic specified below. TOPIC=drop_errprint --- src/routines.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/routines.c b/src/routines.c index 8ccf386..1e85132 100644 --- a/src/routines.c +++ b/src/routines.c @@ -42,8 +42,10 @@ int copy_outside(char *password) #if defined(DISPLAY) int pid; pid = fork(); - if(pid == -1) - errprint_r(1, "X11 fork() failed\n"); + if(pid == -1) { + print_error("Error: X11 fork() failed\n"); + return 1; + } if(pid == 0) /* new process */ exit(run_clipboard(password)); return 0; @@ -52,8 +54,10 @@ int copy_outside(char *password) char * const wl_copy[] = {"wl-copy", password, NULL}; int pid; pid = fork(); - if(pid == -1) - errprint_r(1, "Wayland fork() failed\n"); + if(pid == -1) { + print_error("Error: Wayland fork() failed\n"); + return 1; + } if(pid == 0) { /* new process */ execvp("wl-copy", wl_copy); perror("wl-copy"); @@ -63,7 +67,8 @@ int copy_outside(char *password) return 0; } - errprint_r(1, "You didn't have x11 or wayland when app builded\n"); + print_error("Error: You didn't have x11 or wayland when app builded\n"); + return 1; #endif } -- cgit v1.2.3-18-g5258