On Dec 18  21:09, Bernd Zeimetz wrote:
> hmm, the patch is missing in the mail.
> But thanks in advance!

Oops. here it is :)


--- gpsfake.py.orig	2007-12-18 19:49:36.000000000 +0000
+++ gpsfake.py	2007-12-18 19:50:34.000000000 +0000
@@ -281,6 +281,8 @@
 class DaemonError(exceptions.Exception):
     def __init__(self, msg):
         self.msg = msg
+    def __str__(self):
+            return repr(self.msg)
 
 class DaemonInstance:
     "Control a gpsd instance."
@@ -294,7 +296,10 @@
         self.pidfile  = "/tmp/gpsfake_pid-%s" % os.getpid()
     def spawn(self, options, port, background=False, prefix=""):
         "Spawn a daemon instance."
-        self.spawncmd = "gpsd -N -S %s -F %s -P %s %s" % (port, self.control_socket, self.pidfile, options)
+        self.spawncmd = "/usr/sbin/gpsd"
+        if not os.path.isfile(self.spawncmd) or not os.access(self.spawncmd, os.X_OK):
+                raise DaemonError("Cannot execute %s" % self.spawncmd)
+        self.spawncmd += " -N -S %s -F %s -P %s %s" % (port, self.control_socket, self.pidfile, options)
         if prefix:
             self.spawncmd = prefix + " " + self.spawncmd.strip()
         if background:

Reply via email to