diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-01-13 09:49:01 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-01-13 09:49:01 -0500 |
commit | c93c46f0c10e56b52d3c980e7082ab74f7003f66 (patch) | |
tree | 2bfb119832f8a0deef0c9e0ce2d8ad3c76de5949 | |
parent | 52d4e56c518adf59c3469b1d79eda7e4f56e7f5f (diff) | |
download | gpsd-c93c46f0c10e56b52d3c980e7082ab74f7003f66.tar.gz |
Warning cleanups.
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | contrib/ashctl.c | 4 | ||||
-rw-r--r-- | contrib/binlog.c | 3 | ||||
-rw-r--r-- | contrib/binreplay.c | 2 | ||||
-rw-r--r-- | contrib/lla2ecef.c | 9 | ||||
-rw-r--r-- | monitor_proto.c | 1 |
6 files changed, 12 insertions, 9 deletions
diff --git a/Makefile.am b/Makefile.am index 61a4dad3..25652ac5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -650,7 +650,7 @@ xmllint: $(XML) # ends with other than '0 removed' there's work to be done. ENABLES = -DDEBUG -DPPS_ENABLE -DRAW_ENABLE deheader: - make --quiet clean gpsd.h + make --quiet clean gpsd.h packet_names.h deheader -x 'cpp' -i gpsd_config.h -i gpsd.h -m "MORECFLAGS='-Werror -Wfatal-errors $(ENABLES)' make -e" make --quiet clean diff --git a/contrib/ashctl.c b/contrib/ashctl.c index 10975899..39a45dbb 100644 --- a/contrib/ashctl.c +++ b/contrib/ashctl.c @@ -68,8 +68,8 @@ u: fprintf(stderr, "usage: ashctl <port> [raw|normal]\n" } sleep(1); - read(fd, buf, BUFSIZ-1); - buf[BUFSIZ-1] = '\0'; + i = read(fd, buf, BUFSIZ-1); + buf[i] = '\0'; if (strstr(buf, "$PASH") || strstr(buf, "$GP")) goto done; } diff --git a/contrib/binlog.c b/contrib/binlog.c index 965c3fa0..1506be88 100644 --- a/contrib/binlog.c +++ b/contrib/binlog.c @@ -3,6 +3,7 @@ */ #include <sys/types.h> #include <err.h> +#include <assert.h> #include <errno.h> #include <fcntl.h> #include <stdarg.h> @@ -59,7 +60,7 @@ int main(int argc, char **argv) { while (1){ l = read(ifd, buf, BUFSIZ); if (l > 0) - write(ofd, buf, l); + assert(write(ofd, buf, l) > 0); usleep(1000); bzero(buf, BUFSIZ); spinner( n++ ); diff --git a/contrib/binreplay.c b/contrib/binreplay.c index 13738b88..1e3685bf 100644 --- a/contrib/binreplay.c +++ b/contrib/binreplay.c @@ -34,7 +34,7 @@ int main( int argc, char **argv){ switch(c){ case 'd': dflag = 1; - strlcpy(tn, optarg, 32); + strncpy(tn, optarg, sizeof(tn)-1); break; case 'r': rate = atoi(optarg); diff --git a/contrib/lla2ecef.c b/contrib/lla2ecef.c index 4ec12122..56c68184 100644 --- a/contrib/lla2ecef.c +++ b/contrib/lla2ecef.c @@ -3,21 +3,22 @@ */ #include <sys/types.h> #include <stdio.h> +#include <string.h> #include <stdlib.h> #include <math.h> extern char *__progname; double A = 6378137.0, B = 6356752.3142; -double rad2deg(double r){ +static double rad2deg(double r){ return (180.0 * r / M_PI); } -double deg2rad(double r){ +static double deg2rad(double r){ return (M_PI * r / 180.0); } -void lla2ecef(double *lla, double *ecef){ +static void lla2ecef(double *lla, double *ecef){ double N; lla[0] = deg2rad(lla[0]); @@ -35,7 +36,7 @@ void lla2ecef(double *lla, double *ecef){ return; } -void ecef2lla(double *ecef, double *lla){ +static void ecef2lla(double *ecef, double *lla){ double E, F, N, P, T; E = (pow(A,2) - pow(B,2)) / pow(A,2); diff --git a/monitor_proto.c b/monitor_proto.c index 009486d0..7cd545bc 100644 --- a/monitor_proto.c +++ b/monitor_proto.c @@ -89,6 +89,7 @@ static int PROTO_command(char line[]) * driver-specific commands and leave lowercase ones for the * generic gpsmon ones. */ + assert(strlen(line)); /* * Return COMMAND_UNKNOWN to tell gpsmon you can't interpret the line, and |