diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-02-06 09:20:05 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-02-06 09:20:05 -0800 |
commit | 6a94a074aa0475173a51f3f726377d4c407e986b (patch) | |
tree | 4abe7e1d67e82c308c72c51c5cdbce8beec21ce4 | |
parent | df19c66809165cebd9e2f0ca047e1a128a09681c (diff) | |
download | portage-6a94a074aa0475173a51f3f726377d4c407e986b.tar.gz portage-6a94a074aa0475173a51f3f726377d4c407e986b.tar.bz2 portage-6a94a074aa0475173a51f3f726377d4c407e986b.zip |
spawn: assert that fork returns int type
-rw-r--r-- | pym/portage/process.py | 5 |
1 files changed, 4 insertions, 1 deletions
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) |