Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/
Date: Mon, 06 Feb 2012 17:20:22
Message-Id: 6a94a074aa0475173a51f3f726377d4c407e986b.zmedico@gentoo
1 commit: 6a94a074aa0475173a51f3f726377d4c407e986b
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 6 17:20:05 2012 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 6 17:20:05 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6a94a074
7
8 spawn: assert that fork returns int type
9
10 ---
11 pym/portage/process.py | 5 ++++-
12 1 files changed, 4 insertions(+), 1 deletions(-)
13
14 diff --git a/pym/portage/process.py b/pym/portage/process.py
15 index 1ee5b9a..47b0a21 100644
16 --- a/pym/portage/process.py
17 +++ b/pym/portage/process.py
18 @@ -244,7 +244,7 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False,
19
20 pid = os.fork()
21
22 - if not pid:
23 + if pid == 0:
24 try:
25 _exec(binary, mycommand, opt_name, fd_pipes,
26 env, gid, groups, uid, umask, pre_exec)
27 @@ -259,6 +259,9 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False,
28 sys.stderr.flush()
29 os._exit(1)
30
31 + if not isinstance(pid, int):
32 + raise AssertionError("fork returned non-integer: %s" % (repr(pid),))
33 +
34 # Add the pid to our local and the global pid lists.
35 mypids.append(pid)
36 spawned_pids.append(pid)