summaryrefslogtreecommitdiffstats
path: root/Lib/smtpd.py
diff options
context:
space:
mode:
authorGiampaolo Rodola' <g.rodola@gmail.com>2013-02-12 14:14:17 (GMT)
committerGiampaolo Rodola' <g.rodola@gmail.com>2013-02-12 14:14:17 (GMT)
commit0166a283f65b08ee2dddb1b075f86862b8c7e3e4 (patch)
treef319f122b4865fcba24d86fd4d48f3f923cfea8b /Lib/smtpd.py
parentb071d4f3da8db02dc5b355590f1f909896592ec3 (diff)
downloadcpython-0166a283f65b08ee2dddb1b075f86862b8c7e3e4.zip
cpython-0166a283f65b08ee2dddb1b075f86862b8c7e3e4.tar.gz
cpython-0166a283f65b08ee2dddb1b075f86862b8c7e3e4.tar.bz2
modernize some modules' code by replacing OSError->ENOENT/ENOTDIR/EPERM/EEXIST occurrences with the corresponding pep-3151 exceptions (FileNotFoundError, NotADirectoryError, etc.)
Diffstat (limited to 'Lib/smtpd.py')
-rwxr-xr-xLib/smtpd.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/smtpd.py b/Lib/smtpd.py
index 1e239a1..3cab264 100755
--- a/Lib/smtpd.py
+++ b/Lib/smtpd.py
@@ -850,8 +850,7 @@ if __name__ == '__main__':
nobody = pwd.getpwnam('nobody')[2]
try:
os.setuid(nobody)
- except OSError as e:
- if e.errno != errno.EPERM: raise
+ except PermissionError:
print('Cannot setuid "nobody"; try running with -n option.', file=sys.stderr)
sys.exit(1)
try: