summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Routhier <sar@isc.org>2009-01-22 02:24:54 +0000
committerShawn Routhier <sar@isc.org>2009-01-22 02:24:54 +0000
commit343bef1cd75537e309cea5aab6f0daa764a3e7ee (patch)
tree1d0ad65bed5a4ddf37075dbcbac09b4c3b9c1062
parentf3d90dc9697c61d527489ab906161e48b4134773 (diff)
downloadisc-dhcp-343bef1cd75537e309cea5aab6f0daa764a3e7ee.tar.gz
Update configuration and code to deal with GCC 4.3 see but 19054
-rw-r--r--RELNOTES5
-rw-r--r--client/dhclient.c12
-rw-r--r--common/parse.c16
-rw-r--r--common/print.c6
-rw-r--r--common/tests/test_alloc.c25
-rw-r--r--configure.ac7
-rw-r--r--dst/dst_api.c10
-rw-r--r--includes/cdefs.h21
-rw-r--r--includes/config.h.in3
-rw-r--r--omapip/errwarn.c18
-rw-r--r--relay/dhcrelay.c17
-rw-r--r--server/dhcpd.c17
-rw-r--r--tests/t_api.c7
13 files changed, 104 insertions, 60 deletions
diff --git a/RELNOTES b/RELNOTES
index 9e9d59b7..148b9e14 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -68,6 +68,11 @@ suggested fixes to <dhcp-users@isc.org>.
and Request packets, if the dynamic range covering any requested addresses
had been deleted from configuration.
+- Update the code to deal with GCC 4.3. This included two sets of changes.
+ The first is to the configuration files to include the use of
+ AC_USE_SYSTME_EXTENSIONS. The second is to deal with return values that
+ were being ignored.
+
Changes since 4.0.1rc1
- None.
diff --git a/client/dhclient.c b/client/dhclient.c
index 54626aae..3046d2a6 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -3,7 +3,7 @@
DHCP Client. */
/*
- * Copyright (c) 2004-2008 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2009 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
@@ -61,10 +61,10 @@ struct data_string default_duid;
assert (state_is == state_shouldbe). */
#define ASSERT_STATE(state_is, state_shouldbe) {}
-static char copyright[] = "Copyright 2004-2008 Internet Systems Consortium.";
-static char arr [] = "All rights reserved.";
-static char message [] = "Internet Systems Consortium DHCP Client";
-static char url [] = "For info, please visit http://www.isc.org/sw/dhcp/";
+static const char copyright[] = "Copyright 2004-2009 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 http://www.isc.org/sw/dhcp/";
u_int16_t local_port=0;
u_int16_t remote_port=0;
@@ -3059,7 +3059,7 @@ void go_daemon ()
write_client_pid_file ();
- chdir("/");
+ IGNORE_RET (chdir("/"));
}
void write_client_pid_file ()
diff --git a/common/parse.c b/common/parse.c
index 6f482eaf..f8eefbc6 100644
--- a/common/parse.c
+++ b/common/parse.c
@@ -3,7 +3,7 @@
Common parser code for dhcpd and dhclient. */
/*
- * Copyright (c) 2004-2008 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2009 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
@@ -5604,14 +5604,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 44e0ce15..f172cf76 100644
--- a/common/print.c
+++ b/common/print.c
@@ -3,7 +3,7 @@
Turn data structures into printable text. */
/*
- * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2007,2009 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
@@ -308,7 +308,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;
@@ -332,7 +332,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/common/tests/test_alloc.c b/common/tests/test_alloc.c
index 563fe11c..c0e1b9af 100644
--- a/common/tests/test_alloc.c
+++ b/common/tests/test_alloc.c
@@ -59,10 +59,10 @@ static void
test_buffer_allocate(void) {
static const char *test_desc =
"buffer_allocate basic test";
-
+
struct buffer *buf;
- t_assert("buffer_allocate", 1, T_REQUIRED, test_desc);
+ t_assert("buffer_allocate", 1, T_REQUIRED, "%s", test_desc);
/*
* Check a 0-length buffer.
@@ -115,10 +115,10 @@ test_buffer_reference(void) {
static const char *test_desc =
"buffer_reference basic test";
int result = T_PASS;
-
+
struct buffer *a, *b;
- t_assert("buffer_reference", 1, T_REQUIRED, test_desc);
+ t_assert("buffer_reference", 1, T_REQUIRED, "%s", test_desc);
/*
* Create a buffer.
@@ -186,10 +186,10 @@ static void
test_buffer_dereference(void) {
static const char *test_desc =
"buffer_dereference basic test";
-
+
struct buffer *a, *b;
- t_assert("buffer_dereference", 1, T_REQUIRED, test_desc);
+ t_assert("buffer_dereference", 1, T_REQUIRED, "%s", test_desc);
/*
* Confirm buffer_dereference() doesn't work if we pass in NULL.
@@ -278,12 +278,12 @@ test_data_string_forget(void) {
static const char *test_desc =
"data_string_forget basic test";
int result = T_PASS;
-
+
struct buffer *buf;
struct data_string a;
const char *str = "Lorem ipsum dolor sit amet turpis duis.";
- t_assert("data_string_forget", 1, T_REQUIRED, test_desc);
+ t_assert("data_string_forget", 1, T_REQUIRED, "%s", test_desc);
/*
* Create the string we want to forget.
@@ -347,11 +347,11 @@ test_data_string_forget_nobuf(void) {
static const char *test_desc =
"data_string_forget test, data_string without buffer";
int result = T_PASS;
-
+
struct data_string a;
const char *str = "Lorem ipsum dolor sit amet massa nunc.";
- t_assert("data_string_forget, no buffer", 1, T_REQUIRED, test_desc);
+ t_assert("data_string_forget, no buffer", 1, T_REQUIRED, "%s", test_desc);
/*
* Create the string we want to forget.
@@ -395,7 +395,7 @@ test_data_string_copy(void) {
struct data_string a, b;
const char *str = "Lorem ipsum dolor sit amet orci aliquam.";
- t_assert("data_string_copy", 1, T_REQUIRED, test_desc);
+ t_assert("data_string_copy", 1, T_REQUIRED, "%s", test_desc);
/*
@@ -452,7 +452,8 @@ test_data_string_copy_nobuf(void) {
struct data_string a, b;
const char *str = "Lorem ipsum dolor sit amet cras amet.";
- t_assert("data_string_copy, no buffer", 1, T_REQUIRED, test_desc);
+ t_assert("data_string_copy, no buffer", 1, T_REQUIRED, "%s",
+ test_desc);
/*
diff --git a/configure.ac b/configure.ac
index 1387860a..02ef69f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,6 +23,13 @@ if test "$GCC" = "yes"; then
fi
fi
+# POSIX doesn't include the IPv6 Advanced Socket API and glibc hides
+# parts of the IPv6 Advanced Socket API as a result. This is stupid
+# as it breaks how the two halves (Basic and Advanced) of the IPv6
+# Socket API were designed to be used but we have to live with it.
+# Use this to define _GNU_SOURCE to pull in the IPv6 Advanced Socket API.
+AC_USE_SYSTEM_EXTENSIONS
+
AC_PROG_RANLIB
AC_CONFIG_HEADERS([includes/config.h])
diff --git a/dst/dst_api.c b/dst/dst_api.c
index fff07257..19543991 100644
--- a/dst/dst_api.c
+++ b/dst/dst_api.c
@@ -1,10 +1,10 @@
#ifndef LINT
-static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/dst_api.c,v 1.6 2007/11/30 21:51:43 fdupont Exp $";
+static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/dst_api.c,v 1.6.28.1 2009/01/22 02:24:54 sar Exp $";
#endif
/*
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
- * Portions Copyright (c) 2007 by Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (c) 2007,2009 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
@@ -545,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 3e344c91..887b1484 100644
--- a/includes/cdefs.h
+++ b/includes/cdefs.h
@@ -4,7 +4,7 @@
/*
* Copyright (c) 1995 RadioMail Corporation. All rights reserved.
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004,2009 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
@@ -54,4 +54,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/includes/config.h.in b/includes/config.h.in
index 5936a8cc..4031f707 100644
--- a/includes/config.h.in
+++ b/includes/config.h.in
@@ -7,6 +7,9 @@
/* Define to 1 to include DHCPv6 support. */
#undef DHCPv6
+/* Define to 1 if you need the _GNU_SOURCE flag defined */
+#undef _GNU_SOURCE
+
/* Define to 1 if you have the /dev/random file. */
#undef HAVE_DEV_RANDOM
diff --git a/omapip/errwarn.c b/omapip/errwarn.c
index 9ea90b1f..31d00c44 100644
--- a/omapip/errwarn.c
+++ b/omapip/errwarn.c
@@ -4,7 +4,7 @@
/*
* Copyright (c) 1995 RadioMail Corporation.
- * Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004,2007,2009 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
@@ -70,8 +70,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)
@@ -118,8 +118,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;
@@ -145,8 +145,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;
@@ -172,8 +172,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 fd132a93..b0501d9d 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -3,7 +3,7 @@
DHCP/BOOTP Relay Agent. */
/*
- * Copyright (c) 2004-2008 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2009 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
@@ -96,11 +96,14 @@ struct server_list {
struct sockaddr_in to;
} *servers;
-static char copyright [] = "Copyright 2004-2008 Internet Systems Consortium.";
-static char arr [] = "All rights reserved.";
-static char message [] = "Internet Systems Consortium DHCP Relay Agent";
-static char url [] = "For info, please visit http://www.isc.org/sw/dhcp/";
-
+static const char copyright[] =
+"Copyright 2004-2009 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 http://www.isc.org/sw/dhcp/";
+
int
main(int argc, char **argv) {
int fd;
@@ -315,7 +318,7 @@ main(int argc, char **argv) {
close (2);
pid = setsid ();
- chdir("/");
+ IGNORE_RET (chdir("/"));
}
/* Start dispatching packets and timeouts... */
diff --git a/server/dhcpd.c b/server/dhcpd.c
index e800fa6b..8a1742a4 100644
--- a/server/dhcpd.c
+++ b/server/dhcpd.c
@@ -3,7 +3,7 @@
DHCP Server Daemon. */
/*
- * Copyright (c) 2004-2008 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2009 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
@@ -32,11 +32,12 @@
* ``http://www.nominum.com''.
*/
-static char copyright[] =
-"Copyright 2004-2008 Internet Systems Consortium.";
-static char arr [] = "All rights reserved.";
-static char message [] = "Internet Systems Consortium DHCP Server";
-static char url [] = "For info, please visit http://www.isc.org/sw/dhcp/";
+static const char copyright[] =
+"Copyright 2004-2009 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 http://www.isc.org/sw/dhcp/";
#include "dhcpd.h"
#include <omapip/omapip_p.h>
@@ -665,7 +666,7 @@ main(int argc, char **argv) {
/* 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);
@@ -694,7 +695,7 @@ main(int argc, char **argv) {
open("/dev/null", O_RDWR);
log_perror = 0; /* No sense logging to /dev/null. */
- chdir("/");
+ IGNORE_RET (chdir("/"));
}
#endif /* !DEBUG */
diff --git a/tests/t_api.c b/tests/t_api.c
index 6685cec0..d660e539 100644
--- a/tests/t_api.c
+++ b/tests/t_api.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: t_api.c,v 1.2 2007/11/16 11:04:12 shane Exp $ */
+/* $Id: t_api.c,v 1.2.50.1 2009/01/22 02:24:54 sar Exp $ */
/*! \file */
@@ -61,6 +61,7 @@
#endif /* BIND_SUPPORT */
#include "t_api.h"
+#include "cdefs.h"
static const char *Usage =
"\t-a : run all tests\n"
@@ -245,7 +246,7 @@ main(int argc, char **argv) {
*/
if (T_dir != NULL)
- (void) chdir(T_dir);
+ IGNORE_RET (chdir(T_dir));
/*
* We don't want buffered output.