summaryrefslogtreecommitdiff
path: root/src/leap/services
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-03-12 09:02:08 -0300
committerTomás Touceda <chiiph@leap.se>2013-03-12 09:02:08 -0300
commitcf83b3ffe300058a4ed30d255481f0c781b0b942 (patch)
tree406400f83e9cd2a5542a3dff0eb63a5c9fd3e780 /src/leap/services
parent908a726f0f10722ff8a875f24325ea1be6f293a1 (diff)
Extend path to sbin by default
Diffstat (limited to 'src/leap/services')
-rw-r--r--src/leap/services/eip/vpnlaunchers.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/leap/services/eip/vpnlaunchers.py b/src/leap/services/eip/vpnlaunchers.py
index 9f2967aa..6f277481 100644
--- a/src/leap/services/eip/vpnlaunchers.py
+++ b/src/leap/services/eip/vpnlaunchers.py
@@ -76,7 +76,7 @@ def get_platform_launcher():
# Twisted implementation of which
-def which(name, flags=os.X_OK):
+def which(name, flags=os.X_OK, path_extension="/usr/sbin:/sbin"):
"""
Search PATH for executable files with the given name.
@@ -99,14 +99,14 @@ def which(name, flags=os.X_OK):
order in which they were found.
"""
- # TODO: make sure sbin is in path
-
result = []
exts = filter(None, os.environ.get('PATHEXT', '').split(os.pathsep))
path = os.environ.get('PATH', None)
+ path += ":" + path_extension
if path is None:
return []
- for p in os.environ.get('PATH', '').split(os.pathsep):
+ parts = path.split(os.pathsep)
+ for p in parts:
p = os.path.join(p, name)
if os.access(p, flags):
result.append(p)