In article <ywn94p108yb7....@ntp1.isc.org>,
 Harlan Stenn <st...@ntp.org> writes:
>I'm glad it is working for you and I'd be even happier if we could figure
>out why the NULL string got where it did earlier, as ntpd should never drop
>core like that.

It might be just a simple bug.  The code in that area says:

          if ((len = readlink(device,buffer,sizeof(buffer))) == -1)
            return(0);
          buffer[len] = 0;

          if ((nmea_host = strtok(buffer,":")) == NULL)
            return(0);

          nmea_port = atoi(strtok(NULL,":"));

The idea is that if you are using the nmead, then /dev/gps0
will be a synbilic link to someting like "server:port" so
nmea_host will be the server and nmea_port will be the port number.

My (very old) man page for strtok says:
       The  strtok()  function  can  be  used to parse the string s into
       tokens. The first call to strtok() should have  s  as  its  first
       argument.  Subsequent calls should have the first argument set to
       NULL. Each call returns a pointer to the next token, or NULL when
       no more tokens are found.
A less old (but still far from new) system says:
       The  strtok() function parses a string into a sequence of tokens.
       On the first call to strtok() the string to be parsed  should  be
       specified  in str.  In each subsequent call that should parse the
       same string, str should be NULL.
Both say
       Avoid using these functions.  If you do use them, note that:
     (blah blah...)

So my guess is that either the rules have changed or there is a bug
in the library code.  (More likely, I don't understand something.)

-- 
These are my opinions, not necessarily my employer's.  I hate spam.

_______________________________________________
questions mailing list
questions@lists.ntp.org
https://lists.ntp.org/mailman/listinfo/questions

Reply via email to