]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Fix up args to printf-like functions (thanks to Pedro Ribiero).
authorTed Lemon <source@isc.org>
Tue, 12 Oct 1999 16:00:34 +0000 (16:00 +0000)
committerTed Lemon <source@isc.org>
Tue, 12 Oct 1999 16:00:34 +0000 (16:00 +0000)
client/clparse.c
client/dhclient.c
common/bpf.c
common/tree.c
includes/cdefs.h
includes/dhcpd.h
server/confpars.c
server/dhcp.c

index c6c8b52cd4652279b7d1a04a3e093d655ebf6300..7f12b3b5fc2ec7b78c54fd8734c18ede8af01ff9 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: clparse.c,v 1.36 1999/10/07 06:35:35 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: clparse.c,v 1.37 1999/10/12 16:00:17 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -559,7 +559,7 @@ void parse_option_list (cfile, list)
                                break;
                }
                if (i == 256) {
-                       parse_warn (cfile, "%s: expected option name.");
+                       parse_warn (cfile, "%s: expected option name.", val);
                        skip_to_semi (cfile);
                        return;
                }
index 256aa7935c765efb2ed0ff55b2b9a6ec8dfe25c0..4035c87bcd61ddcad169b7a1591224982980dc66 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char ocopyright[] =
-"$Id: dhclient.c,v 1.84 1999/10/07 06:35:36 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dhclient.c,v 1.85 1999/10/12 16:00:18 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -673,9 +673,9 @@ void bind_lease (client)
        add_timeout (client -> active -> renewal,
                     state_bound, client);
 
-       log_info ("bound to %s -- renewal in %d seconds.",
+       log_info ("bound to %s -- renewal in %ld seconds.",
              piaddr (client -> active -> address),
-             client -> active -> renewal - cur_time);
+             (long)(client -> active -> renewal - cur_time));
        client -> state = S_BOUND;
        reinitialize_interfaces ();
        go_daemon ();
@@ -1205,9 +1205,11 @@ void state_panic (cpp)
                                if (cur_time <
                                    client -> active -> renewal) {
                                        client -> state = S_BOUND;
-                                       log_info ("bound: renewal in %d seconds.",
-                                             client -> active -> renewal
-                                             - cur_time);
+                                       log_info ("bound: renewal in %s %ld.",
+                                                 "seconds",
+                                                 (long)
+                                                 (client -> active -> renewal
+                                                  - cur_time));
                                        add_timeout ((client ->
                                                      active -> renewal),
                                                     state_bound, client);
@@ -2138,7 +2140,8 @@ char *dhcp_option_ev_name (option)
        int i;
 
        if (strlen (option -> name) + 1 > sizeof evbuf)
-               log_fatal ("option %s name is larger than static buffer.");
+               log_fatal ("option %s name is larger than static buffer.",
+                          option -> name);
        for (i = 0; option -> name [i]; i++) {
                if (option -> name [i] == '-')
                        evbuf [i] = '_';
index f6291d7bc368c725e7e2ca325273368f44517066..39ea44768b6d4f67a0722e9eefed2b36b46f28a5 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: bpf.c,v 1.30 1999/10/07 06:47:49 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: bpf.c,v 1.31 1999/10/12 16:00:26 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -227,7 +227,8 @@ void if_register_receive (info)
                log_fatal ("Can't get bpf buffer length: %m");
        info -> rbuf = malloc (info -> rbuf_max);
        if (!info -> rbuf)
-               log_fatal ("Can't allocate %d bytes for bpf input buffer.");
+               log_fatal ("Can't allocate %d bytes for bpf input buffer.",
+                          info -> rbuf_max);
        info -> rbuf_offset = 0;
        info -> rbuf_len = 0;
 
index 5b5cec6effbf42169a5ad65fd22c47ea996b632d..ecf9aedc81e4ddee6af19eb551ada7d48d2cd592 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: tree.c,v 1.59 1999/10/07 06:35:45 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: tree.c,v 1.60 1999/10/12 16:00:27 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -64,7 +64,7 @@ int make_const_option_cache (oc, buffer, data, len, option, name)
        }
 
        if (!option_cache_allocate (oc, name)) {
-               log_error ("%s: can't allocate option cache.");
+               log_error ("%s: can't allocate option cache.", name);
                buffer_dereference (&bp, name);
                return 0;
        }
@@ -1095,7 +1095,7 @@ int evaluate_data_expression (result, packet, lease,
                        unsigned buflen, i;
 
                        if (len != 8 && len != 16 && len != 32) {
-                               log_info ("binary_to_ascii: %s %d!",
+                               log_info ("binary_to_ascii: %s %ld!",
                                          "invalid width", len);
                                goto b2a_out;
                        }
@@ -1104,7 +1104,7 @@ int evaluate_data_expression (result, packet, lease,
                        /* The buffer must be a multiple of the number's
                           width. */
                        if (other.len % len) {
-                               log_info ("binary-to-ascii: %s %d %s %d!",
+                               log_info ("binary-to-ascii: %s %d %s %ld!",
                                          "length of buffer", other.len,
                                          "not a multiple of width", len);
                                status = 0;
@@ -1211,7 +1211,7 @@ int evaluate_data_expression (result, packet, lease,
                        /* The buffer must be a multiple of the number's
                           width. */
                        if (other.len % len) {
-                               log_info ("reverse: %s %d %s %d!",
+                               log_info ("reverse: %s %d %s %ld!",
                                          "length of buffer", other.len,
                                          "not a multiple of width", len);
                                status = 0;
index f968a806ed99f7ea4800616b6c4ff7b8cc1a472c..02fc7fcd37dd7dd115ead151c495aa13345a89da 100644 (file)
 
 #if !defined (__ISC_DHCP_CDEFS_H__)
 #define __ISC_DHCP_CDEFS_H__
+/* Delete attributes if not gcc or not the right version of gcc. */
+#if !defined(__GNUC__) || __GNUC__ < 2 || \
+        (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
+#define __attribute__(x)
+#endif
+
 #if (defined (__GNUC__) || defined (__STDC__)) && !defined (BROKEN_ANSI)
 #define PROTO(x)       x
 #define KandR(x)
index f5fbb60d55a3595edf0d5d7c0998bbf76f84c41c..2c0f5cf0e3f6e2d272721c4177df11bb603e59db 100644 (file)
@@ -900,11 +900,16 @@ int hashed_option_space_encapsulate PROTO ((struct data_string *,
                                            struct universe *));
 
 /* errwarn.c */
-void log_fatal PROTO ((const char *, ...));
-int log_error PROTO ((const char *, ...));
-int log_info PROTO ((const char *, ...));
-int log_debug PROTO ((const char *, ...));
-int parse_warn PROTO ((struct parse *, const char *, ...));
+void log_fatal PROTO ((const char *, ...))
+       __attribute__((__format__(__printf__,1,2)));
+int log_error PROTO ((const char *, ...))
+       __attribute__((__format__(__printf__,1,2)));
+int log_info PROTO ((const char *, ...))
+       __attribute__((__format__(__printf__,1,2)));
+int log_debug PROTO ((const char *, ...))
+       __attribute__((__format__(__printf__,1,2)));
+int parse_warn PROTO ((struct parse *, const char *, ...))
+       __attribute__((__format__(__printf__,2,3)));
 
 /* dhcpd.c */
 extern TIME cur_time;
index dec99ab9553d8a27afa03c7ba07b40234bc32b8b..0e1c793458f115f51f8f16d5c96cee58494a9864 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: confpars.c,v 1.87 1999/10/07 06:36:30 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: confpars.c,v 1.88 1999/10/12 16:00:33 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -445,7 +445,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
                        if (token == CODE) {
                                if (type != ROOT_GROUP) {
                                        parse_warn (cfile,
-                                                   "option definitions%s%s",
+                                                   "option definitions%s",
                                                    " may not be scoped.");
                                        skip_to_semi (cfile);
                                        free_option (option,
@@ -513,7 +513,7 @@ int parse_statement (cfile, group, type, host_decl, declaration)
                                                    "expecting a declaration");
                                    else
                                        parse_warn (cfile,
-                                                   "expecting a parameter %s"
+                                                   "expecting a parameter %s",
                                                    "or declaration");
                                        skip_to_semi (cfile);
                                }
@@ -1119,8 +1119,8 @@ void parse_host_declaration (cfile, group)
                                
                status = enter_host (host, dynamicp, 0);
                if (status != ISC_R_SUCCESS)
-                       parse_warn (cfile,
-                                   "host %s: %s", isc_result_totext (status));
+                       parse_warn (cfile, "host %s: %s", host -> name,
+                                   isc_result_totext (status));
        }
 }
 
index 9a1aabfe766c96ac7170ae79144e6617f84d724a..547bed6539469b584c91de2980bb5e49c87e5a35 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dhcp.c,v 1.116 1999/10/08 22:21:34 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dhcp.c,v 1.117 1999/10/12 16:00:34 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -978,8 +978,8 @@ void ack_lease (packet, lease, offer, when, msg)
                                           oc)) {
                        if (d1.len && packet -> raw -> secs < d1.data [0]) {
                                data_string_forget (&d1, "ack_lease");
-                               log_info ("%s: %d secs < %d",
-                                     packet -> raw -> secs, d1.data [0]);
+                               log_info ("%s: %d secs < %d", msg,
+                                         packet -> raw -> secs, d1.data [0]);
                                free_lease_state (state, "ack_lease");
                                static_lease_dereference (lease, "ack_lease");
                                return;