Skip to content

Commit

Permalink
popen() wants pclose() not fclose()
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Mar 4, 2022
1 parent 16dd1bd commit 0c9879a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/omphalos/popen.c
Expand Up @@ -73,10 +73,10 @@ int popen_drain(const char *cmd){
}
if(!feof(fd)){
diagnostic("Error reading from '%s' (%s?)",cmd,strerror(errno));
fclose(fd);
pclose(fd);
return -1;
}
if(fclose(fd)){
if(pclose(fd)){
diagnostic("Error running '%s'",cmd);
return -1;
}
Expand Down Expand Up @@ -105,13 +105,13 @@ char *spopen_drain(const char *cmd){
}
}
if(!feof(fd)){
if(o < s){
if(o < s){
diagnostic("Error reading from '%s' (%s?)",cmd,strerror(errno));
fclose(fd);
pclose(fd);
free(buf);
return NULL;
}
}else if(fclose(fd)){
}
}else if(pclose(fd)){
diagnostic("Error running '%s'",cmd);
free(buf);
return NULL;
Expand Down

0 comments on commit 0c9879a

Please sign in to comment.