summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2014-06-23 22:14:14 +0200
committerJoel Rosdahl <joel@rosdahl.net>2014-06-23 22:14:14 +0200
commit3ac33094c2dc633b461853e21fadb5ea81462118 (patch)
tree6d16462aeee236757ff21e7c431da3dfc965cf9f
parentbc02cbd8939093189712a97ae4df2babeb8d14ce (diff)
downloadminiircd-3ac33094c2dc633b461853e21fadb5ea81462118.tar.gz
miniircd-3ac33094c2dc633b461853e21fadb5ea81462118.zip
Only import pwd and grp modules when needed since Windows doesn't have them
-rwxr-xr-xminiircd4
1 files changed, 2 insertions, 2 deletions
diff --git a/miniircd b/miniircd
index 580574e..22f8773 100755
--- a/miniircd
+++ b/miniircd
@@ -32,8 +32,6 @@ import tempfile
import time
from datetime import datetime
from optparse import OptionParser
-from pwd import getpwnam
-from grp import getgrnam
def create_directory(path):
if not os.path.isdir(path):
@@ -873,6 +871,8 @@ def main(argv):
if os.getuid() != 0:
op.error("Must be root to use --chroot")
if options.setuid:
+ from pwd import getpwnam
+ from grp import getgrnam
if os.getuid() != 0:
op.error("Must be root to use --setuid")
match = re.findall(r"([a-z_][a-z0-9_-]*\$?)", options.setuid)