mirror of
https://github.com/Orc/discount.git
synced 2026-09-25 04:10:00 +03:00
don't use WNOHANG in waitpid; check child status to see if the formatter exited normally or abended & return the original code fragment if the latter
This commit is contained in:
@@ -141,11 +141,14 @@ external_codefmt(char *src, int len, char *lang)
|
|||||||
res = realloc(res, bufsize += 1000);
|
res = realloc(res, bufsize += 1000);
|
||||||
}
|
}
|
||||||
res[curr] = 0;
|
res[curr] = 0;
|
||||||
waitpid(child, &child_status, WNOHANG);
|
waitpid(child, &child_status, 0);
|
||||||
|
|
||||||
close(toparent[RECEIVER]);
|
close(toparent[RECEIVER]);
|
||||||
|
|
||||||
return res;
|
if ( WIFEXITED(child_status) )
|
||||||
|
return res;
|
||||||
|
else
|
||||||
|
free(res); /* something failed; just return the original string */
|
||||||
}
|
}
|
||||||
else if ( child == 0 ) {
|
else if ( child == 0 ) {
|
||||||
close(tochild[SENDER]);
|
close(tochild[SENDER]);
|
||||||
|
|||||||
Reference in New Issue
Block a user