diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1998-06-02 18:46:57 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1998-06-02 18:46:57 +0000 |
commit | 45991cb50203de74c1c1c5d26fc2da3fc6e9ea8e (patch) | |
tree | 50f2558109a37b762ee34a17dafff8725de1859e /fetchmailconf | |
parent | 2ee0b76e32167ccd94889a618253c4c4d0188958 (diff) | |
download | fetchmail-45991cb50203de74c1c1c5d26fc2da3fc6e9ea8e.tar.gz fetchmail-45991cb50203de74c1c1c5d26fc2da3fc6e9ea8e.tar.bz2 fetchmail-45991cb50203de74c1c1c5d26fc2da3fc6e9ea8e.zip |
Better error checking.
svn path=/trunk/; revision=1872
Diffstat (limited to 'fetchmailconf')
-rwxr-xr-x | fetchmailconf | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/fetchmailconf b/fetchmailconf index 6f1c74dc..828f4da4 100755 --- a/fetchmailconf +++ b/fetchmailconf @@ -1108,9 +1108,21 @@ if __name__ == '__main__': # Read the existing configuration tmpfile = "/tmp/fetchmailconf." + `os.getpid()` - os.system("fetchmail --configdump >" + tmpfile) - execfile(tmpfile) - os.remove(tmpfile) + try: + s = os.system("fechmail --configdump >" + tmpfile) + if s != 0: + print "Fetchmail run failure, status " + `s` + raise SystemExit + + s = execfile(tmpfile) + if s: + print "Invalid configuration, status " + `s` + raise SystemExit + except: + os.remove(tmpfile) + sys.exit(1) + else: + os.remove(tmpfile) # The tricky part -- initializing objects from the configuration global # `Configuration' is the top level of the object tree we're going to mung |