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 01:45:01 +0100

On Tue, Oct 27, 2015 at 11:27 PM, Gary E. Miller <address@hidden> wrote:
> Yo Nuno!
>
> On Tue, 27 Oct 2015 12:05:06 +0000
> Nuno Gonçalves <address@hidden> wrote:
>
>> I try to open a non-existing device:
>
>> Is this error recoverable? If not, GPSD should terminate and return so
>> that the calling script is aware of the failure.
>
> Yup, nice catch.  If there was a control socket it would, in theory, be
> recoverable, but in this simple case an abort seems in order.
>
> Do you have an idea for a patch?

How does this look for you?

--- 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,8 +2054,15 @@ 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(!device_opened){
+               gpsd_log(&context.errout, LOG_ERROR,
+                "can't run with no devices open\n");
+       exit(EXIT_FAILURE);
+       }

     /* drop privileges */
     if (0 == getuid()) {


Thanks,
Nuno



reply via email to

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