]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Don't die when getuid() or getpid() aren't defined.
authorGuido van Rossum <guido@python.org>
Mon, 26 Aug 1996 16:40:20 +0000 (16:40 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 26 Aug 1996 16:40:20 +0000 (16:40 +0000)
Lib/mimetools.py

index da33a7777b9713f76fc48fb95cdddb8cc21b1979..baf9379f537a52eba04713ee6aaea76f84b738ed 100644 (file)
@@ -106,8 +106,14 @@ def choose_boundary():
                import socket
                import os
                hostid = socket.gethostbyname(socket.gethostname())
-               uid = `os.getuid()`
-               pid = `os.getpid()`
+               try:
+                   uid = `os.getuid()`
+               except:
+                   uid = '1'
+               try:
+                   pid = `os.getpid()`
+               except:
+                   pid = '1'
                seed = `rand.rand()`
                _prefix = hostid + '.' + uid + '.' + pid
        timestamp = `int(time.time())`