Replace PERR macro with appropriate logging macro
This commit is contained in:
parent
19b364d67c
commit
58dc09b415
@ -9,8 +9,6 @@
|
||||
|
||||
#include "notification.h"
|
||||
|
||||
#define PERR(msg, errnum) printf("(%d) %s : %s\n", __LINE__, (msg), (strerror(errnum)))
|
||||
|
||||
#define ColLast 3
|
||||
#define ColFrame 2
|
||||
#define ColFG 1
|
||||
|
10
src/menu.c
10
src/menu.c
@ -214,12 +214,12 @@ void context_menu(void)
|
||||
int child_io[2];
|
||||
int parent_io[2];
|
||||
if (pipe(child_io) != 0) {
|
||||
PERR("pipe()", errno);
|
||||
LOG_W("pipe(): error in child: %s", strerror(errno));
|
||||
g_free(dmenu_input);
|
||||
return;
|
||||
}
|
||||
if (pipe(parent_io) != 0) {
|
||||
PERR("pipe()", errno);
|
||||
LOG_W("pipe(): error in parent: %s", strerror(errno));
|
||||
g_free(dmenu_input);
|
||||
return;
|
||||
}
|
||||
@ -230,12 +230,12 @@ void context_menu(void)
|
||||
close(parent_io[0]);
|
||||
close(0);
|
||||
if (dup(child_io[0]) == -1) {
|
||||
PERR("dup()", errno);
|
||||
LOG_W("dup(): error in child: %s", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
close(1);
|
||||
if (dup(parent_io[1]) == -1) {
|
||||
PERR("dup()", errno);
|
||||
LOG_W("dup(): error in parent: %s", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
execvp(settings.dmenu_cmd[0], settings.dmenu_cmd);
|
||||
@ -244,7 +244,7 @@ void context_menu(void)
|
||||
close(parent_io[1]);
|
||||
size_t wlen = strlen(dmenu_input);
|
||||
if (write(child_io[1], dmenu_input, wlen) != wlen) {
|
||||
PERR("write()", errno);
|
||||
LOG_W("write(): error: %s", strerror(errno));
|
||||
}
|
||||
close(child_io[1]);
|
||||
|
||||
|
@ -108,7 +108,7 @@ void notification_run_script(notification *n)
|
||||
urgency,
|
||||
(char *)NULL);
|
||||
if (ret != 0) {
|
||||
PERR("Unable to run script", errno);
|
||||
LOG_W("Unable to run script: %s", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user