From 6a94a074aa0475173a51f3f726377d4c407e986b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 6 Feb 2012 09:20:05 -0800 Subject: spawn: assert that fork returns int type --- pym/portage/process.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pym/portage/process.py') 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) -- cgit v1.2.3-1-g7c22