ncneofetch: popen(3) wants pclose(3), not fclose(3)

pull/1825/head
Nick Black 3 years ago
parent 7df761c041
commit ec5ba6da80

@ -156,12 +156,12 @@ pipe_getline(const char* cmdline){
char* buf = malloc(BUFSIZ); // gatesv("BUFSIZ bytes is enough for anyone")
if(fgets(buf, BUFSIZ, p) == NULL){
//fprintf(stderr, "Error reading from %s (%s)\n", cmdline, strerror(errno));
fclose(p);
pclose(p);
free(buf);
return NULL;
}
// FIXME read any remaining junk so as to stave off SIGPIPEs?
if(fclose(p)){
if(pclose(p)){
fprintf(stderr, "Error closing pipe (%s)\n", strerror(errno));
free(buf);
return NULL;

Loading…
Cancel
Save