summaryrefslogtreecommitdiff
path: root/dgpsip.c
diff options
context:
space:
mode:
authorChris Kuethe <chris.kuethe@gmail.com>2006-08-18 17:21:16 +0000
committerChris Kuethe <chris.kuethe@gmail.com>2006-08-18 17:21:16 +0000
commit2bf1a6cd107419f99c93652e28e166ba20632134 (patch)
treed5fa4ab5a3b012ed612672c2edd55547aa99784d /dgpsip.c
parent7531b0dc90ba667f7b3a8a4fab2a699911301b5f (diff)
downloadgpsd-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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dgpsip.c b/dgpsip.c
index e0dc041e..0a1d2297 100644
--- a/dgpsip.c
+++ b/dgpsip.c
@@ -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);