]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Update for 19054 - modifications to keep GCC 4.3 happy
authorShawn Routhier <sar@isc.org>
Thu, 22 Jan 2009 00:43:58 +0000 (00:43 +0000)
committerShawn Routhier <sar@isc.org>
Thu, 22 Jan 2009 00:43:58 +0000 (00:43 +0000)
12 files changed:
client/dhclient.c
common/parse.c
common/print.c
common/tests/test_alloc.c
configure.ac
dst/dst_api.c
includes/cdefs.h
includes/config.h.in
omapip/errwarn.c
relay/dhcrelay.c
server/dhcpd.c
tests/t_api.c

index c71003997a73cd13cf19aba6a5c0f67bf88cc035..dcd294a8ce6d167e1d1cbf0b33bad4e76687fb8a 100644 (file)
@@ -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 ()
index 11092ed92a6bf063b27b063693fabd1b99d96285..d2842b484ae29cb78df62459282bf1bbc2094980 100644 (file)
@@ -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;
index 44e0ce15f0de5f865be59912cb2e75928267cb46..f172cf76a3e081555d0459e9c35ce5f50dee50e7 100644 (file)
@@ -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)
index 563fe11cd643acf666a254460a24bfb38491adf9..c0e1b9af7315d50fb4d9f8ee45f27e4f355ec200 100644 (file)
@@ -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);
 
 
        /* 
index f16ee875f1ed10fafcff147a496f8d2401df651a..522129d2cc301ddb9c7bc545b34301a9899c1380 100644 (file)
@@ -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])
 
index fff072573c54c9ed34e2888e54d2e601e7e9686c..3cac622da7f35d538861a1f40607fa311b256481 100644 (file)
@@ -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)
index 3e344c914541bac5ef1985769bf7fd5f96510b6a..887b148465759d9b40de0bcd1b99665c45b8b8dd 100644 (file)
@@ -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
 #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__ */
index d6db4b02561f1f76692806a62b2e452ab64750d2..c7ecffe79423d2881f38b9c29d9a37ba8a10802d 100644 (file)
@@ -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
 
index 9ea90b1fa49c0029696535d7aa3a2be06032863f..31d00c445cbacef83eb61372689b63b9880b4cf7 100644 (file)
@@ -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;
index e585c900b613e27c10b67383a622504f93dc7959..342e2eb40b67d850b4fabed56a940ba927ec4a70 100644 (file)
@@ -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... */
index 3d4d8c0b7ef879d78e725c9ef3e14c060c9bb1a4..b5b7888e2e86fb1fda8c734e0147dc645c5224e3 100644 (file)
@@ -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
  * ``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 */
 
index 6685cec077b9200f7e94d6d2c623ed2a2759ee65..0211b834ac84b95d1d8f2c3b8cb4af7acf9756fe 100644 (file)
@@ -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.