gpsd-dev
[Top][All Lists]
Advanced

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

Re: [RFC] get gpsd to work with gnss-share


From: Gary E. Miller
Subject: Re: [RFC] get gpsd to work with gnss-share
Date: Wed, 11 Jan 2023 20:56:38 -0800

Yo Pavel!

On Sun, 8 Jan 2023 16:34:05 +0100
Pavel Machek <pavel@ucw.cz> wrote:

> > > > +    } else if (str_starts_with(session->gpsdata.dev.path,
> > > > "unix://")) {    

Now that the gpsd release is done, I thought about this some more.

Is this code tested and works with gnss-share?

If so, then the basic concept works, but the code needs work.

For example:

+               printf("Connecting at path: %s\n", server);

gpsd has its own logging functions so that logging levels, and
logging destinations, can be adjusted.  printf() is not compatible,

+        session->sourcetype = source_tcp;

AF_UNIX sockets are clearly not TCP!  That enum will need to be expanded.

+               strcpy(addr.sun_path, server);

gpsd does not use strcpy(),  too easy to overrun the destination location.
Use strlcpy().

+#include <sys/un.h>

Why do you need that include?  Place that in a comment on the same line.


+        socket_t dsock;
+        (void)strlcpy(server, session->gpsdata.dev.path + 7, sizeof(server));

One blank line (think PEP 8) between the last staroage declaration and
the first code.

+        if (dsock < 0) {

Yoda style please.


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

            Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

Attachment: pgpyrNNL_ZjQq.pgp
Description: OpenPGP digital signature


reply via email to

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