summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2012-05-10 21:35:32 -0400
committerEric S. Raymond <esr@thyrsus.com>2012-05-10 21:35:32 -0400
commit1b2ae0a79fb7ece3824336e28b072ba96f32ea01 (patch)
tree4d830b3141569b5fd62fdfa8714dd7462084c426
parent48c0b06a55c2a3fed0869d976fdc186c9051e24d (diff)
downloadgpsd-1b2ae0a79fb7ece3824336e28b072ba96f32ea01.tar.gz
Suppress Coverity false positives.
-rw-r--r--gpsd.c9
-rw-r--r--gpsdctl.c1
-rw-r--r--net_ntrip.c3
3 files changed, 12 insertions, 1 deletions
diff --git a/gpsd.c b/gpsd.c
index bb8bfde4..ef73014f 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -2063,6 +2063,7 @@ int main(int argc, char *argv[])
/* make default devices accessible even after we drop privileges */
for (i = optind; i < argc; i++)
+ /* coverity[toctou] */
if (stat(argv[i], &stb) == 0)
(void)chmod(argv[i], stb.st_mode | S_IRGRP | S_IWGRP);
/*
@@ -2131,6 +2132,14 @@ int main(int argc, char *argv[])
struct sigaction sa;
sa.sa_flags = 0;
+#ifdef __linux__
+ /*
+ * Obsolete and unused. We're really only doing this to pacify Coverity
+ * which otherwise throws an UNINIT event here. Don't swap with the
+ * handler initialization, they're unioned on some architectures.
+ */
+ sa.sa_restorer = NULL;
+#endif /* __linux__ */
sa.sa_handler = onsig;
(void)sigfillset(&sa.sa_mask);
(void)sigaction(SIGHUP, &sa, NULL);
diff --git a/gpsdctl.c b/gpsdctl.c
index 59214bfb..a3346d47 100644
--- a/gpsdctl.c
+++ b/gpsdctl.c
@@ -67,6 +67,7 @@ static int gpsd_control(char *action, char *argument)
*/
struct stat sb;
+ /* coverity[toctou] */
if (stat(argument, &sb) != 1)
(void)chmod(argument, sb.st_mode | S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
(void)snprintf(buf, sizeof(buf), "+%s\r\n", argument);
diff --git a/net_ntrip.c b/net_ntrip.c
index 98a9ebd0..5ef8ab0f 100644
--- a/net_ntrip.c
+++ b/net_ntrip.c
@@ -170,7 +170,7 @@ static int ntrip_sourcetable_parse(struct gps_device_t *device)
ssize_t rlen;
memset(&buf[len], 0, (size_t) (blen - len));
-
+ /* coverity[string_null] - guaranteed terminated by previous memset */
rlen = read(fd, &buf[len], (size_t) (blen - 1 - len));
if (rlen == -1) {
if (errno == EINTR) {
@@ -389,6 +389,7 @@ static int ntrip_stream_get_parse(const struct ntrip_stream_t *stream, int dsock
char buf[BUFSIZ];
int opts;
memset(buf, 0, sizeof(buf));
+ /* coverity[string_null] - guaranteed terminated by previous memset */
while (read(dsock, buf, sizeof(buf) - 1) == -1) {
if (errno == EINTR)
continue;