From: Zac Medico Date: Mon, 6 Feb 2012 17:20:05 +0000 (-0800) Subject: spawn: assert that fork returns int type X-Git-Tag: v2.2.0_alpha86~59 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=6a94a074aa0475173a51f3f726377d4c407e986b;p=portage.git spawn: assert that fork returns int type --- diff --git a/pym/portage/process.py b/pym/portage/process.py index 1ee5b9ae6..47b0a2147 100644 --- a/pym/portage/process.py +++ b/pym/portage/process.py @@ -244,7 +244,7 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False, pid = os.fork() - if not pid: + if pid == 0: try: _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups, uid, umask, pre_exec) @@ -259,6 +259,9 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False, sys.stderr.flush() os._exit(1) + if not isinstance(pid, int): + raise AssertionError("fork returned non-integer: %s" % (repr(pid),)) + # Add the pid to our local and the global pid lists. mypids.append(pid) spawned_pids.append(pid)