]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Prevent Linux spurious warnings about fwrite(). [RT #20812]
authorFrancis Dupont <fdupont@isc.org>
Mon, 11 Jan 2010 10:49:14 +0000 (10:49 +0000)
committerFrancis Dupont <fdupont@isc.org>
Mon, 11 Jan 2010 10:49:14 +0000 (10:49 +0000)
CHANGES
bin/dnssec/dnssec-dsfromkey.c
bin/tests/cfg_test.c
lib/dns/dst_api.c
lib/dns/dst_parse.c
lib/isc/include/isc/util.h

diff --git a/CHANGES b/CHANGES
index cb79cfef7a8063fd0fcc7c2b79b53edb2e853ceb..9ebc7a9a24f411c150d52a3b7c09b282b7e8c42c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+2837.  [port]          Prevent Linux spurious warnings about fwrite().
+                       [RT #20812]
+
 2836.  [bug]           Keys that were scheduled to become active could
                        be delayed. [RT #20874]
 
index f2408a8d60c2ee26e5c20fc2aa6234ebace2fbdb..d699c7837862b3e4be478dd06485ee475314066d 100644 (file)
@@ -14,7 +14,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: dnssec-dsfromkey.c,v 1.16 2009/10/12 20:48:10 each Exp $ */
+/* $Id: dnssec-dsfromkey.c,v 1.17 2010/01/11 10:49:14 fdupont Exp $ */
 
 /*! \file */
 
@@ -265,12 +265,12 @@ emit(unsigned int dtype, isc_boolean_t showall, char *lookaside,
                fatal("can't print class");
 
        isc_buffer_usedregion(&nameb, &r);
-       fwrite(r.base, 1, r.length, stdout);
+       isc_util_fwrite(r.base, 1, r.length, stdout);
 
        putchar(' ');
 
        isc_buffer_usedregion(&classb, &r);
-       fwrite(r.base, 1, r.length, stdout);
+       isc_util_fwrite(r.base, 1, r.length, stdout);
 
        if (lookaside == NULL)
                printf(" DS ");
@@ -278,7 +278,7 @@ emit(unsigned int dtype, isc_boolean_t showall, char *lookaside,
                printf(" DLV ");
 
        isc_buffer_usedregion(&textb, &r);
-       fwrite(r.base, 1, r.length, stdout);
+       isc_util_fwrite(r.base, 1, r.length, stdout);
        putchar('\n');
 }
 
index 25a372cfec1e049cee24dc8a3fa937778cf46b33..0b959902b4d5271a8647d653b356bf5a8c82ab09 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: cfg_test.c,v 1.21 2009/03/02 23:47:43 tbox Exp $ */
+/* $Id: cfg_test.c,v 1.22 2010/01/11 10:49:14 fdupont Exp $ */
 
 /*! \file */
 
@@ -49,7 +49,7 @@ check_result(isc_result_t result, const char *format, ...) {
 static void
 output(void *closure, const char *text, int textlen) {
        UNUSED(closure);
-       (void) fwrite(text, 1, textlen, stdout);
+       (void) isc_util_fwrite(text, 1, textlen, stdout);
 }
 
 static void
index c0bc43d41bf38ad4384c3081ecb942cfbc01a5a1..bafe405345704b6480223edef34b3619309c296b 100644 (file)
@@ -31,7 +31,7 @@
 
 /*
  * Principal Author: Brian Wellington
- * $Id: dst_api.c,v 1.47 2009/11/07 03:36:58 each Exp $
+ * $Id: dst_api.c,v 1.48 2010/01/11 10:49:14 fdupont Exp $
  */
 
 /*! \file */
@@ -1450,7 +1450,7 @@ write_public_key(const dst_key_t *key, int type, const char *directory) {
        fprintf(fp, " ");
 
        isc_buffer_usedregion(&classb, &r);
-       fwrite(r.base, 1, r.length, fp);
+       isc_util_fwrite(r.base, 1, r.length, fp);
 
        if ((type & DST_TYPE_KEY) != 0)
                fprintf(fp, " KEY ");
@@ -1458,7 +1458,7 @@ write_public_key(const dst_key_t *key, int type, const char *directory) {
                fprintf(fp, " DNSKEY ");
 
        isc_buffer_usedregion(&textb, &r);
-       fwrite(r.base, 1, r.length, fp);
+       isc_util_fwrite(r.base, 1, r.length, fp);
 
        fputc('\n', fp);
        fflush(fp);
index 0dfd5171a84d5c6c103136635398b82958bc36e2..fd2f1d115ced1a199ed69a8dd7473775028bf369 100644 (file)
@@ -31,7 +31,7 @@
 
 /*%
  * Principal Author: Brian Wellington
- * $Id: dst_parse.c,v 1.25 2010/01/08 23:51:44 tbox Exp $
+ * $Id: dst_parse.c,v 1.26 2010/01/11 10:49:14 fdupont Exp $
  */
 
 #include <config.h>
@@ -626,7 +626,7 @@ dst__privstruct_writefile(const dst_key_t *key, const dst_private_t *priv,
                isc_buffer_usedregion(&b, &r);
 
                fprintf(fp, "%s ", s);
-               fwrite(r.base, 1, r.length, fp);
+               isc_util_fwrite(r.base, 1, r.length, fp);
                fprintf(fp, "\n");
        }
 
@@ -651,7 +651,7 @@ dst__privstruct_writefile(const dst_key_t *key, const dst_private_t *priv,
                        isc_buffer_usedregion(&b, &r);
 
                        fprintf(fp, "%s ", timetags[i]);
-                       fwrite(r.base, 1, r.length, fp);
+                       isc_util_fwrite(r.base, 1, r.length, fp);
                        fprintf(fp, "\n");
                }
        }
index 8a3b95d9da36f1b21b7306f6e3faad44f7c57446..97c9a890013599832a279f91d182adaff1abb3ac 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: util.h,v 1.30 2007/06/19 23:47:18 tbox Exp $ */
+/* $Id: util.h,v 1.31 2010/01/11 10:49:14 fdupont Exp $ */
 
 #ifndef ISC_UTIL_H
 #define ISC_UTIL_H 1
  */
 #define TIME_NOW(tp)   RUNTIME_CHECK(isc_time_now((tp)) == ISC_R_SUCCESS)
 
+/*%
+ * Prevent Linux spurious warnings
+ */
+#if defined(__GNUC__) && (__GNUC__ > 3)
+#define isc_util_fwrite(a, b, c, d)    \
+       __builtin_expect(fwrite((a), (b), (c), (d)), (c))
+#else
+#define isc_util_fwrite(a, b, c, d)    fwrite((a), (b), (c), (d))
+#endif
+
 #endif /* ISC_UTIL_H */