check waitpid() return value before setting exitStatus

This fixes a race with parallelBuild on DragonFly BSD.
This commit is contained in:
Johannes Hofmann
2016-12-02 22:24:42 +01:00
parent d6ab21eed5
commit b453a8e616

View File

@@ -965,7 +965,7 @@ elif not defined(useNimRtl):
var ret : int
var status : cint = 1
ret = waitpid(p.id, status, WNOHANG)
if WIFEXITED(status):
if ret == int(p.id) and WIFEXITED(status):
p.exitStatus = status
if ret == 0: return true # Can't establish status. Assume running.
result = ret == int(p.id)