summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Routhier <sar@isc.org>2010-03-17 19:32:13 +0000
committerShawn Routhier <sar@isc.org>2010-03-17 19:32:13 +0000
commitc33ce1287f929a018bf29bd5b653a4d6ced4d48e (patch)
treef5e64ca6e7c5786fe020d050db951e08c1a6382c
parent3827b719e1f570eff75596084a3a232cbc38070a (diff)
downloadisc-dhcp-c33ce1287f929a018bf29bd5b653a4d6ced4d48e.tar.gz
Clean up some compiler warnings - ticket 19054.
-rw-r--r--RELNOTES3
-rw-r--r--client/dhclient.c14
-rw-r--r--common/parse.c18
-rw-r--r--common/print.c9
-rw-r--r--dst/dst_api.c9
-rw-r--r--includes/cdefs.h20
-rw-r--r--omapip/errwarn.c19
-rw-r--r--relay/dhcrelay.c14
-rw-r--r--server/dhcpd.c16
9 files changed, 76 insertions, 46 deletions
diff --git a/RELNOTES b/RELNOTES
index 23b0b273..6f9e4a28 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -51,6 +51,9 @@ the README file.
- When using 'ignore client-updates;', the FQDN returned to the client
is no longer truncated to one octet.
+- Clean up some compiler warnings - ticket 19054.
+
+
Changes since 3.1.3rc1
- None.
diff --git a/client/dhclient.c b/client/dhclient.c
index a9a0993d..a083a31f 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -3,7 +3,7 @@
DHCP Client. */
/*
- * Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
@@ -32,7 +32,7 @@
#ifndef lint
static char ocopyright[] =
-"$Id: dhclient.c,v 1.143.2.14 2009/09/01 20:32:27 dhankins Exp $ Copyright (c) 2004-2009 Internet Systems Consortium. All rights reserved.\n";
+"$Id: dhclient.c,v 1.143.2.15 2010/03/17 19:32:12 sar Exp $ Copyright (c) 2004-2009 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -61,11 +61,11 @@ struct in_addr giaddr;
assert (state_is == state_shouldbe). */
#define ASSERT_STATE(state_is, state_shouldbe) {}
-static char copyright[] =
- "Copyright 2004-2009 Internet Systems Consortium.";
-static char arr [] = "All rights reserved.";
-static char message [] = "Internet Systems Consortium DHCP Client";
-static char url [] =
+static const char copyright[] =
+ "Copyright 2004-2010 Internet Systems Consortium.";
+static const char arr[] = "All rights reserved.";
+static const char message[] = "Internet Systems Consortium DHCP Client";
+static const char url[] =
"For info, please visit https://www.isc.org/software/dhcp/";
u_int16_t local_port=0;
diff --git a/common/parse.c b/common/parse.c
index 61a60a50..20dfa011 100644
--- a/common/parse.c
+++ b/common/parse.c
@@ -3,7 +3,7 @@
Common parser code for dhcpd and dhclient. */
/*
- * Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: parse.c,v 1.117.8.12 2009/09/01 20:32:27 dhankins Exp $ Copyright (c) 2004-2009 Internet Systems Consortium. All rights reserved.\n";
+"$Id: parse.c,v 1.117.8.13 2010/03/17 19:32:13 sar Exp $ Copyright (c) 2004-2009 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -5342,14 +5342,14 @@ int parse_warn (struct parse *cfile, const char *fmt, ...)
#endif
if (log_perror) {
- write (STDERR_FILENO, mbuf, strlen (mbuf));
- write (STDERR_FILENO, "\n", 1);
- write (STDERR_FILENO, cfile -> token_line,
- strlen (cfile -> token_line));
- write (STDERR_FILENO, "\n", 1);
+ IGNORE_RET(write(STDERR_FILENO, mbuf, strlen (mbuf)));
+ IGNORE_RET(write(STDERR_FILENO, "\n", 1));
+ IGNORE_RET(write(STDERR_FILENO, cfile -> token_line,
+ strlen (cfile -> token_line)));
+ IGNORE_RET(write(STDERR_FILENO, "\n", 1));
if (cfile -> lexchar < 81)
- write (STDERR_FILENO, lexbuf, lix);
- write (STDERR_FILENO, "^\n", 2);
+ IGNORE_RET(write(STDERR_FILENO, lexbuf, lix));
+ IGNORE_RET(write(STDERR_FILENO, "^\n", 2));
}
cfile -> warnings_occurred = 1;
diff --git a/common/print.c b/common/print.c
index 0ff18ef0..04c9864f 100644
--- a/common/print.c
+++ b/common/print.c
@@ -3,7 +3,8 @@
Turn data structures into printable text. */
/*
- * Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2009-2010 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
@@ -34,7 +35,7 @@
#ifndef lint
static char copyright[] =
-"$Id: print.c,v 1.61.12.7 2009/09/01 20:32:27 dhankins Exp $ Copyright (c) 2004-2007,2009 Internet Systems Consortium. All rights reserved.\n";
+"$Id: print.c,v 1.61.12.8 2010/03/17 19:32:13 sar Exp $ Copyright (c) 2004-2007,2009 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -313,7 +314,7 @@ void dump_raw (buf, len)
lbuf[54]=' ';
lbuf[55]=' ';
lbuf[73]='\0';
- log_info (lbuf);
+ log_info("%s", lbuf);
}
memset(lbuf, ' ', 79);
lbuf [79] = 0;
@@ -337,7 +338,7 @@ void dump_raw (buf, len)
lbuf[54]=' ';
lbuf[55]=' ';
lbuf[73]='\0';
- log_info (lbuf);
+ log_info("%s", lbuf);
}
void hash_dump (table)
diff --git a/dst/dst_api.c b/dst/dst_api.c
index c028895d..c79b3810 100644
--- a/dst/dst_api.c
+++ b/dst/dst_api.c
@@ -1,9 +1,10 @@
#ifndef LINT
-static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/dst_api.c,v 1.1.272.1 2007/05/29 17:49:44 each Exp $";
+static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/dst_api.c,v 1.1.272.2 2010/03/17 19:32:13 sar Exp $";
#endif
/*
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
+ * Portions Copyright (c) 2010 by Internet systems Consortium, Inc. ("ISC")
*
* Permission to use, copy modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -544,7 +545,11 @@ dst_s_read_public_key(const char *in_name, const unsigned in_id, int in_alg)
return (NULL);
}
/* read in the key string */
- fgets(enckey, sizeof(enckey), fp);
+ if ((fgets(enckey, sizeof(enckey), fp) == NULL) &&
+ (ferror(fp) != 0)) {
+ EREPORT(("dst_read_public_kety(): Error reading key\n"));
+ return (NULL);
+ }
/* If we aren't at end-of-file, something is wrong. */
while ((c = getc(fp)) != EOF)
diff --git a/includes/cdefs.h b/includes/cdefs.h
index c9e53545..18a562b3 100644
--- a/includes/cdefs.h
+++ b/includes/cdefs.h
@@ -4,6 +4,7 @@
/*
* Copyright (c) 1995 RadioMail Corporation. All rights reserved.
+ * Copyright (c) 2010 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
@@ -54,4 +55,23 @@
#define ANSI_DECL(x)
#define INLINE
#endif /* __GNUC__ || __STDC__ */
+
+/* The following macro handles the case of unwanted return values. In
+ * GCC one can specify an attribute for a function to generate a warning
+ * if the return value of the function is ignored and one can't dispose of
+ * the warning by the use of void. In conjunction with the use of -Werror
+ * these warnings prohibit the compilation of the package. This macro
+ * allows us to assign the return value to a variable and then ignore it.
+ */
+#if !defined(__GNUC__) || (__GNUC__ < 4) || \
+ ((__GNUC__ == 4) && (__GNUC_MINOR__ < 3))
+#define IGNORE_RET(x) (void) x
+#else
+#define IGNORE_RET(x) \
+ do { \
+ int ignore_return; \
+ ignore_return = x; \
+ } while (0)
+#endif
+
#endif /* __ISC_DHCP_CDEFS_H__ */
diff --git a/omapip/errwarn.c b/omapip/errwarn.c
index 904fe5e3..74852511 100644
--- a/omapip/errwarn.c
+++ b/omapip/errwarn.c
@@ -4,6 +4,7 @@
/*
* Copyright (c) 1995 RadioMail Corporation.
+ * Copyright (c) 2010 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
@@ -33,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: errwarn.c,v 1.10.140.1 2009/07/23 21:43:35 sar Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: errwarn.c,v 1.10.140.2 2010/03/17 19:32:13 sar Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include <omapip/omapip_p.h>
@@ -72,8 +73,8 @@ void log_fatal (const char * fmt, ... )
/* Also log it to stderr? */
if (log_perror) {
- write (STDERR_FILENO, mbuf, strlen (mbuf));
- write (STDERR_FILENO, "\n", 1);
+ IGNORE_RET(write(STDERR_FILENO, mbuf, strlen (mbuf)));
+ IGNORE_RET(write(STDERR_FILENO, "\n", 1));
}
#if !defined (NOMINUM)
@@ -120,8 +121,8 @@ int log_error (const char * fmt, ...)
#endif
if (log_perror) {
- write (STDERR_FILENO, mbuf, strlen (mbuf));
- write (STDERR_FILENO, "\n", 1);
+ IGNORE_RET(write(STDERR_FILENO, mbuf, strlen (mbuf)));
+ IGNORE_RET(write(STDERR_FILENO, "\n", 1));
}
return 0;
@@ -147,8 +148,8 @@ int log_info (const char *fmt, ...)
#endif
if (log_perror) {
- write (STDERR_FILENO, mbuf, strlen (mbuf));
- write (STDERR_FILENO, "\n", 1);
+ IGNORE_RET(write(STDERR_FILENO, mbuf, strlen (mbuf)));
+ IGNORE_RET(write(STDERR_FILENO, "\n", 1));
}
return 0;
@@ -174,8 +175,8 @@ int log_debug (const char *fmt, ...)
#endif
if (log_perror) {
- write (STDERR_FILENO, mbuf, strlen (mbuf));
- write (STDERR_FILENO, "\n", 1);
+ IGNORE_RET(write(STDERR_FILENO, mbuf, strlen (mbuf)));
+ IGNORE_RET(write(STDERR_FILENO, "\n", 1));
}
return 0;
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index 435865af..c95065d6 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -3,7 +3,7 @@
DHCP/BOOTP Relay Agent. */
/*
- * Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1997-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
@@ -34,7 +34,7 @@
#ifndef lint
static char ocopyright[] =
-"$Id: dhcrelay.c,v 1.59.2.7 2009/09/01 20:32:28 dhankins Exp $ Copyright (c) 2004-2009 Internet Systems Consortium. All rights reserved.\n";
+"$Id: dhcrelay.c,v 1.59.2.8 2010/03/17 19:32:13 sar Exp $ Copyright (c) 2004-2009 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -101,11 +101,11 @@ struct server_list {
struct sockaddr_in to;
} *servers;
-static char copyright [] =
- "Copyright 2004-2009 Internet Systems Consortium.";
-static char arr [] = "All rights reserved.";
-static char message [] = "Internet Systems Consortium DHCP Relay Agent";
-static char url [] =
+static const char copyright[] =
+ "Copyright 2004-2010 Internet Systems Consortium.";
+static const char arr[] = "All rights reserved.";
+static const char message[] = "Internet Systems Consortium DHCP Relay Agent";
+static const char url[] =
"For info, please visit https://www.isc.org/software/dhcp/";
int main (argc, argv, envp)
diff --git a/server/dhcpd.c b/server/dhcpd.c
index 01b3d4b3..e82508aa 100644
--- a/server/dhcpd.c
+++ b/server/dhcpd.c
@@ -3,7 +3,7 @@
DHCP Server Daemon. */
/*
- * Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
@@ -34,14 +34,14 @@
#ifndef lint
static char ocopyright[] =
-"$Id: dhcpd.c,v 1.121.42.8 2009/09/01 20:32:28 dhankins Exp $ Copyright 2004-2009 Internet Systems Consortium.";
+"$Id: dhcpd.c,v 1.121.42.9 2010/03/17 19:32:13 sar Exp $ Copyright 2004-2009 Internet Systems Consortium.";
#endif
-static char copyright[] =
- "Copyright 2004-2009 Internet Systems Consortium.";
-static char arr [] = "All rights reserved.";
-static char message [] = "Internet Systems Consortium DHCP Server";
-static char url [] =
+static const char copyright[] =
+ "Copyright 2004-2010 Internet Systems Consortium.";
+static const char arr[] = "All rights reserved.";
+static const char message[] = "Internet Systems Consortium DHCP Server";
+static const char url[] =
"For info, please visit https://www.isc.org/software/dhcp/";
#include "dhcpd.h"
@@ -553,7 +553,7 @@ int main (argc, argv, envp)
/* Write new pid file. */
if ((i = open(path_dhcpd_pid, O_WRONLY|O_CREAT|O_TRUNC, 0644)) >= 0) {
sprintf(pbuf, "%d\n", (int) getpid());
- write(i, pbuf, strlen(pbuf));
+ IGNORE_RET(write(i, pbuf, strlen(pbuf)));
close(i);
} else {
log_error("Can't create PID file %s: %m.", path_dhcpd_pid);