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: Mon, 13 Jun 2016 01:31:04 +0100

And sorry but it had a mistake. Please check this. (diff also in attach).

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;

Thanks,
Nuno

On Sun, Jun 12, 2016 at 11:18 PM, Nuno Gonçalves <address@hidden> wrote:
> Any chance to give a look at this?
>
> I refreshed the patch:
>
> diff --git a/gpsd.c b/gpsd.c
> index d98d446..1521045 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,28 @@ 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;
>
> Thanks,
> Nuno
>
> On Thu, Apr 14, 2016 at 2:14 AM, Nuno Gonçalves <address@hidden> wrote:
>> 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;

Attachment: diff
Description: Binary data


reply via email to

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