]> git.llucax.com Git - software/pymin.git/commitdiff
Catch exception when trying to write /proc/.../ip_forward in the config file.
authorLeandro Lucarella <llucax@gmail.com>
Fri, 16 May 2008 21:59:53 +0000 (18:59 -0300)
committerLeandro Lucarella <llucax@gmail.com>
Wed, 21 May 2008 16:01:56 +0000 (13:01 -0300)
This way pymind can be used by non-root users.

config.py

index 7a9b60452ddeb6cef41be1a2c78e9a6b5121d8d5..aae79c185fa02ae0783d5e5828de3d46bc29f95c 100644 (file)
--- a/config.py
+++ b/config.py
@@ -20,9 +20,12 @@ config_path = join(base_path, 'config')
 class Root(Handler):
 
     def __init__(self):
-        f = file("/proc/sys/net/ipv4/ip_forward","w")
-        f.write("1")
-        f.close()
+        try:
+            f = file("/proc/sys/net/ipv4/ip_forward","w")
+            f.write("1")
+            f.close()
+        except (IOError, OSError), e:
+            print "Can't set ip_forward:", e
         #self.ip.device_up_hook(self.dns)
 
     firewall = FirewallHandler(