Added explicit try/except handling around opening of output files.
1 parent dd866ff commit ec8b8a405f6c8ccc446aea942043689b54251704
@root root authored on 5 Apr 2005
Showing 1 changed file
View
27
mkapachepw.py
 
# Program Information
 
PROGNAME = "mkapachepw"
RCSID = "$Id: mkapachepw.py,v 1.111 2005/04/05 21:44:36 root Exp $"
RCSID = "$Id: mkapachepw.py,v 1.112 2005/04/05 21:56:30 root Exp $"
VERSION = RCSID.split()[2]
 
# Copyright Information
 
os.umask(0377)
 
# Group File
 
grfile = open(GRFILE, "w")
try:
grfile = open(GRFILE, "w")
except:
ErrorMsg("Cannot Open/Create File '%s'." % GRFILE)
sys.exit(3)
grfile.write(TIMESTAMP)
grfile.write(CMDLINE)
 
# Write out groups if they are either protected or >= specified starting ID
grfile.write("%s: %s\n" % (gname, " ".join(groups[gname][1])))
 
grfile.close()
 
 
# Password File
 
pwfile = open(PWFILE, "w")
try:
pwfile = open(PWFILE, "w")
except:
ErrorMsg("Cannot Open/Create File '%s'." % PWFILE)
sys.exit(3)
pwfile.write(TIMESTAMP)
pwfile.write(CMDLINE)
 
# Write out users if they are either protected or >= specified starting ID