gpsd-dev
[Top][All Lists]
Advanced

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

Re: [gpsd-dev] gpsd doesn't terminate but crash with a SIGINT.


From: Nuno Gonçalves
Subject: Re: [gpsd-dev] gpsd doesn't terminate but crash with a SIGINT.
Date: Thu, 14 Apr 2016 02:14:30 +0100

On Thu, Apr 14, 2016 at 1:53 AM, Gary E. Miller <address@hidden> wrote:
> Yo Nuno!
>
> You say:
>
>> +                "can't run with no devices open\n");
>
> But, gpsd can run with no devices opened, if started with the -F
> control-socket option.  Does your patch allow for that?

I believe this would:

--- a/gpsd.c
+++ b/gpsd.c
@@ -1835,6 +1835,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;

@@ -2053,9 +2054,27 @@ 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
+#if defined(CONTROL_SOCKET_ENABLE) && defined(SYSTEMD_ENABLE)
+       &&
+#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;



reply via email to

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