summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.c15
-rw-r--r--server/dhcpd.c17
-rw-r--r--tests/t_api.c7
12 files changed, 98 insertions, 59 deletions
diff --git a/client/dhclient.c b/client/dhclient.c
index c7100399..dcd294a8 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
@@ -62,10 +62,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;
@@ -3295,7 +3295,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 11092ed9..d2842b48 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
@@ -5674,14 +5674,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 f16ee875..522129d2 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..3cac622d 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.7 2009/01/22 00:43:58 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 d6db4b02..c7ecffe7 100644
--- a/includes/config.h.in
+++ b/includes/config.h.in
@@ -22,6 +22,9 @@
/* Define to include Failover Protocol support. */
#undef FAILOVER_PROTOCOL
+/* 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 e585c900..342e2eb4 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
@@ -126,10 +126,13 @@ static int strip_relay_agent_options(struct interface_info *,
struct interface_info **,
struct dhcp_packet *, unsigned);
-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/";
#ifdef DHCPv6
#define DHCRELAY_USAGE \
@@ -531,7 +534,7 @@ main(int argc, char **argv) {
close(2);
pid = setsid();
- chdir("/");
+ IGNORE_RET (chdir("/"));
}
/* Set up the packet handler... */
diff --git a/server/dhcpd.c b/server/dhcpd.c
index 3d4d8c0b..b5b7888e 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>
@@ -783,7 +784,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);
@@ -812,7 +813,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..0211b834 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.3 2009/01/22 00:43:58 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.