[Zodb-checkins] CVS: ZODB3/ZEO - start.py:1.37
Jeremy Hylton
jeremy@zope.com
Thu, 25 Jul 2002 19:08:33 -0400
Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv17775
Modified Files:
start.py
Log Message:
Fix use of uid/UID with set_uid() func.
=== ZODB3/ZEO/start.py 1.36 => 1.37 ===
cache[(d, m)] = im
return getattr(im, n)
-def set_uid(uid):
+def set_uid(arg):
"""Try to set uid and gid based on -u argument.
This will only work if this script is run by root.
@@ -58,13 +58,13 @@
try:
gid = None
try:
- UID = int(UID)
+ arg = int(arg)
except: # conversion could raise all sorts of errors
- uid = pwd.getpwnam(UID)[2]
- gid = pwd.getpwnam(UID)[3]
+ uid = pwd.getpwnam(arg)[2]
+ gid = pwd.getpwnam(arg)[3]
else:
- uid = pwd.getpwuid(UID)[2]
- gid = pwd.getpwuid(UID)[3]
+ uid = pwd.getpwuid(arg)[2]
+ gid = pwd.getpwuid(arg)[3]
if gid is not None:
try:
os.setgid(gid)
@@ -75,7 +75,7 @@
except OSError:
pass
except KeyError:
- LOG('ZEO Server', ERROR, ("can't find UID %s" % UID))
+ LOG('ZEO Server', ERROR, ("can't find uid %s" % arg))
def setup_signals(storages):
try:
@@ -231,7 +231,7 @@
if detailed:
os.environ['STUPID_LOG_SEVERITY'] = '-300'
- set_uid(uid)
+ set_uid(UID)
if Z:
try: