gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] [PATCH] gpsd: EXIT if device fails to open and there are no c


From: Nuno Gonçalves
Subject: [gpsd-dev] [PATCH] gpsd: EXIT if device fails to open and there are no control sockets available to make a recover possible
Date: Mon, 13 Jun 2016 19:39:48 +0100

Signed-off-by: Nuno Goncalves <address@hidden>
---
 gpsd.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/gpsd.c b/gpsd.c
index d98d446..a70b31c 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1839,6 +1839,7 @@ int main(int argc, char *argv[])
     struct gps_device_t *device;
     int i, option;
     int msocks[2] = {-1, -1};
+    bool device_opened = false;
     bool go_background = true;
     volatile bool in_restart;

@@ -2057,9 +2058,25 @@ int main(int argc, char *argv[])
     gpsd_log(&context.errout, LOG_ERROR,
      "initial GPS device %s open failed\n",
      argv[i]);
+ } else {
+            device_opened = true;
  }
     }

+    if (
+#ifdef CONTROL_SOCKET_ENABLE
+       control_socket == NULL &&
+#endif
+#ifdef SYSTEMD_ENABLE
+       sd_socket_count <= 0 &&
+#endif
+       !device_opened) {
+       gpsd_log(&context.errout, LOG_ERROR,
+                "can't run with neither control socket nor devices open\n");
+       exit(EXIT_FAILURE);
+    }
+
+
     /* drop privileges */
     if (0 == getuid()) {
  struct passwd *pw;
-- 
2.7.4

Attachment: 0001-gpsd-EXIT-if-device-fails-to-open-and-there-are-no-c.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]