aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2022-08-26 14:34:00 +0300
committerJoursoir <chat@joursoir.net>2022-08-26 20:58:53 +0300
commit85b4b0d67cc69a2b9440091f9634f2fa04b7ffea (patch)
treed8c5c4b31da5666041e739c48573b0b7fb9c7d12
parent6367ccb1572450b81524ddec477edb0d1fb8c103 (diff)
downloadlock-password-85b4b0d67cc69a2b9440091f9634f2fa04b7ffea.tar.gz
lock-password-85b4b0d67cc69a2b9440091f9634f2fa04b7ffea.tar.bz2
lock-password-85b4b0d67cc69a2b9440091f9634f2fa04b7ffea.zip
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
-rw-r--r--src/routines.c15
1 files 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
}