]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3143. [bug] Silence clang compiler warnings. [RT #25174]
authorMark Andrews <marka@isc.org>
Thu, 18 Aug 2011 04:52:35 +0000 (04:52 +0000)
committerMark Andrews <marka@isc.org>
Thu, 18 Aug 2011 04:52:35 +0000 (04:52 +0000)
CHANGES
bin/dnssec/dnssec-dsfromkey.c
lib/dns/dst_api.c
lib/dns/dst_parse.c

diff --git a/CHANGES b/CHANGES
index ee2f3ba0193eea80fec279db4b5d6139e79f8e9c..9ad8a7e62d5c103d30e37c67dd20790ad496cb41 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+3143.  [bug]           Silence clang compiler warnings. [RT #25174]
+
 3142.  [bug]           NAPTR is class agnostic. [RT #25429]
 
 3141.  [bug]           Silence spurious "zone serial (0) unchanged" messages
index 9c9f623bccbc27d4cae5b6475bfd8f3ad0e0ec87..d79c21999ef379a30779e6cd196831a78b8404d9 100644 (file)
@@ -14,7 +14,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: dnssec-dsfromkey.c,v 1.21 2011/03/24 23:47:48 tbox Exp $ */
+/* $Id: dnssec-dsfromkey.c,v 1.22 2011/08/18 04:52:35 marka Exp $ */
 
 /*! \file */
 
@@ -292,12 +292,10 @@ emit(unsigned int dtype, isc_boolean_t showall, char *lookaside,
                fatal("can't print class");
 
        isc_buffer_usedregion(&nameb, &r);
-       isc_util_fwrite(r.base, 1, r.length, stdout);
-
-       putchar(' ');
+       printf("%.*s ", (int)r.length, r.base);
 
        isc_buffer_usedregion(&classb, &r);
-       isc_util_fwrite(r.base, 1, r.length, stdout);
+       printf("%.*s", (int)r.length, r.base);
 
        if (lookaside == NULL)
                printf(" DS ");
@@ -305,8 +303,7 @@ emit(unsigned int dtype, isc_boolean_t showall, char *lookaside,
                printf(" DLV ");
 
        isc_buffer_usedregion(&textb, &r);
-       isc_util_fwrite(r.base, 1, r.length, stdout);
-       putchar('\n');
+       printf("%.*s\n", (int)r.length, r.base);
 }
 
 ISC_PLATFORM_NORETURN_PRE static void
index 1a26cf0bbef36777347f30d769d16e4e5e989342..1405d7d32ca7e0b96b97ebacfd8c868e6bf33c81 100644 (file)
@@ -31,7 +31,7 @@
 
 /*
  * Principal Author: Brian Wellington
- * $Id: dst_api.c,v 1.59 2011/03/21 19:54:03 each Exp $
+ * $Id: dst_api.c,v 1.60 2011/08/18 04:52:35 marka Exp $
  */
 
 /*! \file */
@@ -1579,7 +1579,8 @@ write_public_key(const dst_key_t *key, int type, const char *directory) {
                fprintf(fp, "%d ", key->key_ttl);
 
        isc_buffer_usedregion(&classb, &r);
-       isc_util_fwrite(r.base, 1, r.length, fp);
+       if (isc_util_fwrite(r.base, 1, r.length, fp) != r.length)
+               ret = DST_R_WRITEERROR;
 
        if ((type & DST_TYPE_KEY) != 0)
                fprintf(fp, " KEY ");
@@ -1587,7 +1588,8 @@ write_public_key(const dst_key_t *key, int type, const char *directory) {
                fprintf(fp, " DNSKEY ");
 
        isc_buffer_usedregion(&textb, &r);
-       isc_util_fwrite(r.base, 1, r.length, fp);
+       if (isc_util_fwrite(r.base, 1, r.length, fp) != r.length)
+               ret = DST_R_WRITEERROR;
 
        fputc('\n', fp);
        fflush(fp);
index bba0101a328692a91ab7da74144b925f10aff8be..b3f3c275eb0ff19b61df415944c34f8128764dce 100644 (file)
@@ -31,7 +31,7 @@
 
 /*%
  * Principal Author: Brian Wellington
- * $Id: dst_parse.c,v 1.27 2010/12/23 04:07:58 marka Exp $
+ * $Id: dst_parse.c,v 1.28 2011/08/18 04:52:35 marka Exp $
  */
 
 #include <config.h>
@@ -641,9 +641,7 @@ dst__privstruct_writefile(const dst_key_t *key, const dst_private_t *priv,
                }
                isc_buffer_usedregion(&b, &r);
 
-               fprintf(fp, "%s ", s);
-               isc_util_fwrite(r.base, 1, r.length, fp);
-               fprintf(fp, "\n");
+               fprintf(fp, "%s %.*s\n", s, (int)r.length, r.base);
        }
 
        /* Add the metadata tags */
@@ -661,14 +659,15 @@ dst__privstruct_writefile(const dst_key_t *key, const dst_private_t *priv,
 
                        isc_buffer_init(&b, buffer, sizeof(buffer));
                        result = dns_time32_totext(when, &b);
-                       if (result != ISC_R_SUCCESS)
-                               continue;
+                       if (result != ISC_R_SUCCESS) {
+                               fclose(fp);
+                               return (DST_R_INVALIDPRIVATEKEY);
+                       }
 
                        isc_buffer_usedregion(&b, &r);
 
-                       fprintf(fp, "%s ", timetags[i]);
-                       isc_util_fwrite(r.base, 1, r.length, fp);
-                       fprintf(fp, "\n");
+                       fprintf(fp, "%s %.*s\n", timetags[i], (int)r.length,
+                                r.base);
                }
        }