diff options
author | Chris Kuethe <chris.kuethe@gmail.com> | 2006-08-18 17:21:16 +0000 |
---|---|---|
committer | Chris Kuethe <chris.kuethe@gmail.com> | 2006-08-18 17:21:16 +0000 |
commit | 2bf1a6cd107419f99c93652e28e166ba20632134 (patch) | |
tree | d5fa4ab5a3b012ed612672c2edd55547aa99784d /dgpsip.c | |
parent | 7531b0dc90ba667f7b3a8a4fab2a699911301b5f (diff) | |
download | gpsd-2bf1a6cd107419f99c93652e28e166ba20632134.tar.gz |
strchr returns char *, and NULL if it can't find what was sought.
Test the return value appropriately.
Diffstat (limited to 'dgpsip.c')
-rw-r--r-- | dgpsip.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -19,7 +19,7 @@ int dgpsip_open(struct gps_context_t *context, const char *dgpsserver) char *colon, *dgpsport = "rtcm-sc104"; int opts; - if ((colon = strchr(dgpsserver, ':'))) { + if ((colon = strchr(dgpsserver, ':')) != NULL) { dgpsport = colon+1; *colon = '\0'; } @@ -101,7 +101,7 @@ void dgpsip_autoconnect(struct gps_context_t *context, /*@ -usedef @*/ while (fgets(buf, (int)sizeof(buf), sfp)) { char *cp = strchr(buf, '#'); - if (cp) + if (cp != NULL) *cp = '\0'; if (sscanf(buf,"%lf %lf %256s",&hold.lat, &hold.lon, hold.server)==3) { hold.dist = earth_distance(lat, lon, hold.lat, hold.lon); |