mirror of https://github.com/python/cpython
More robust way of choosing a non-existant uid (faster, too).
This commit is contained in:
parent
037b2205e8
commit
6308d510e9
|
@ -59,10 +59,10 @@ except KeyError:
|
||||||
else:
|
else:
|
||||||
print 'fakename', fakename, 'did not except pwd.getpwnam()'
|
print 'fakename', fakename, 'did not except pwd.getpwnam()'
|
||||||
|
|
||||||
uids = byuids.keys()
|
# Choose a non-existant uid.
|
||||||
uids.sort()
|
fakeuid = 4127
|
||||||
uids.reverse()
|
while byuids.has_key(fakeuid):
|
||||||
fakeuid = uids[0] + 1
|
print 'fakeuid =', fakeuid
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pwd.getpwuid(fakeuid)
|
pwd.getpwuid(fakeuid)
|
||||||
|
|
Loading…
Reference in New Issue