diff options
author | 2012-03-22 16:32:25 +0100 | |
---|---|---|
committer | 2012-03-22 16:32:25 +0100 | |
commit | de906a60dc3db1c0d50a338fc562ad50caea3dc4 (patch) | |
tree | 90babc73573242ddcb1e7b30999e36694a13b9ab /scripts | |
parent | Fix -r option without -b (diff) | |
download | tatt-de906a60dc3db1c0d50a338fc562ad50caea3dc4.tar.gz tatt-de906a60dc3db1c0d50a338fc562ad50caea3dc4.tar.bz2 tatt-de906a60dc3db1c0d50a338fc562ad50caea3dc4.zip |
Implement the safedir option
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/tatt | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/tatt b/scripts/tatt index d8206c2..cecd7c7 100755 --- a/scripts/tatt +++ b/scripts/tatt @@ -92,11 +92,20 @@ try: int(options.bugnum) except ValueError: print ("The bugnumber you gave with -b should be an integer.") - exit(1); + exit(1) except TypeError: # This occurs if bugnum is None, that is, -b was not given pass +## If safedir is set, check for the current directory +if config['safedir'] != "": + if os.getcwd().find(config['safedir']) == -1: + # Safedir not found + print ("Your safedir variable is set to '" + config['safedir'] + "',") + print ("but you are in " + os.getcwd()) + print ("Exiting.") + exit (1) + ## Checking for root, tatt should be run as a user, I guess. ## Remove on occasion. if (Popen(['whoami'], stdout=PIPE).communicate()[0].rstrip() == 'root'): |