Commit a91029a0 authored by Francis Dupont's avatar Francis Dupont
Browse files

Prevent Linux spurious warnings about fwrite(). [RT #20812]

parent 36399b2e
2837. [port] Prevent Linux spurious warnings about fwrite().
[RT #20812]
2836. [bug] Keys that were scheduled to become active could
be delayed. [RT #20874]
......
......@@ -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');
}
......
......@@ -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
......
......@@ -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);
......
......@@ -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");
}
}
......
......@@ -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
......@@ -230,4 +230,14 @@
*/
#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 */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment