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: Gary E. Miller
Subject: Re: [gpsd-dev] gpsd doesn't terminate but crash with a SIGINT.
Date: Wed, 13 Apr 2016 17:53:09 -0700

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?

On Thu, 14 Apr 2016 01:45:01 +0100
Nuno Gonçalves <address@hidden> wrote:

> 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
> 




RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

Attachment: pgp94DnDexlTi.pgp
Description: OpenPGP digital signature


reply via email to

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