ncneofetch: don't leak stderr from popen

pull/1016/head
nick black 4 years ago committed by Nick Black
parent 108548e9dc
commit 8f089bc017

@ -100,7 +100,7 @@ pipe_getline(const char* cmdline){
} }
char* buf = malloc(BUFSIZ); // gatesv("BUFSIZ bytes is enough for anyone") char* buf = malloc(BUFSIZ); // gatesv("BUFSIZ bytes is enough for anyone")
if(fgets(buf, BUFSIZ, p) == NULL){ if(fgets(buf, BUFSIZ, p) == NULL){
fprintf(stderr, "Error reading from %s (%s)\n", cmdline, strerror(errno)); //fprintf(stderr, "Error reading from %s (%s)\n", cmdline, strerror(errno));
fclose(p); fclose(p);
free(buf); free(buf);
return NULL; return NULL;
@ -116,7 +116,7 @@ pipe_getline(const char* cmdline){
static int static int
fetch_x_props(fetched_info* fi){ fetch_x_props(fetched_info* fi){
char* xrandr = pipe_getline("xrandr --current"); char* xrandr = pipe_getline("xrandr --current 2>/dev/null");
if(xrandr == NULL){ if(xrandr == NULL){
return -1; return -1;
} }

Loading…
Cancel
Save