Skip to content
Snippets Groups Projects
Commit a90920e3 authored by Nils Schneider's avatar Nils Schneider
Browse files

gluon-announced: avoid spawning zombies

parent 40321595
No related branches found
No related tags found
No related merge requests found
......@@ -51,9 +51,6 @@ void usage() {
char *run_script(size_t *length, const char *script) {
FILE *f;
f = popen(script, "r");
char *buffer;
buffer = calloc(BUFFER, sizeof(char));
......@@ -63,6 +60,7 @@ char *run_script(size_t *length, const char *script) {
return NULL;
}
f = popen(script, "r");
size_t read_bytes = 0;
while (1) {
......@@ -74,8 +72,10 @@ char *run_script(size_t *length, const char *script) {
read_bytes += ret;
}
if (fclose(f) != 0)
fprintf(stderr, "fclose on script failed\n");
int ret = pclose(f);
if (ret != 0)
fprintf(stderr, "script exited with status %d\n", ret);
*length = read_bytes;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment