[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [arm/master] fix: existance check before removing paths
commit 3af68f600f58f3a791958a94d274d70676efeec7
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Wed Jul 27 06:19:13 2011 -0700
fix: existance check before removing paths
---
src/resources/torrcOverride/override.py | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/resources/torrcOverride/override.py b/src/resources/torrcOverride/override.py
index 3e42892..21e6b28 100755
--- a/src/resources/torrcOverride/override.py
+++ b/src/resources/torrcOverride/override.py
@@ -102,18 +102,19 @@ def remove():
print "removing %s group..." % GROUP
os.system("delgroup --quiet %s" % GROUP)
- # might not exist since this is compiled and placed separately
- try:
- print "removing '/bin/torrc-override'..."
- os.remove("/bin/torrc-override")
- except OSError:
- print " no such path"
+ if os.path.exists("/bin/torrc-override"):
+ try:
+ print "removing '/bin/torrc-override'..."
+ os.remove("/bin/torrc-override")
+ except OSError, exc:
+ print " unsuccessful: %s" % exc
- try:
- print "removing '/var/lib/tor-arm'..."
- shutil.rmtree("/var/lib/tor-arm/")
- except Exception, exc:
- print " unsuccessful: %s" % exc
+ if os.path.exists("/var/lib/tor-arm/"):
+ try:
+ print "removing '/var/lib/tor-arm'..."
+ shutil.rmtree("/var/lib/tor-arm/")
+ except Exception, exc:
+ print " unsuccessful: %s" % exc
def replaceTorrc():
orig_uid = os.getuid()
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits