From: David VaĊĦek Date: Thu, 25 Sep 2025 09:04:52 +0000 (+0200) Subject: properly check fprintf() and fclose() return value X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a215cdd93fc3f0f9ecef479f8fd21bdf85c9155;p=thirdparty%2Fknot-dns.git properly check fprintf() and fclose() return value JSON functions, tests, and debug functions, where it isn't vital, remain without checking. Checking and reporting for log and stats files will be solved separately. --- diff --git a/src/contrib/files.c b/src/contrib/files.c index 89a8186762..4d58694552 100644 --- a/src/contrib/files.c +++ b/src/contrib/files.c @@ -248,12 +248,12 @@ int copy_file(const char *dest, const char *src) done: free(tmp_name); - if (file != NULL) { - fclose(file); + if (file != NULL && fclose(file) == -1 && ret == KNOT_EOK) { + ret = knot_map_errno(); } free(buf); if (from != NULL) { - fclose(from); + (void)fclose(from); } return ret; } diff --git a/src/contrib/json.c b/src/contrib/json.c index aba6d59fbc..3a4f1cb66f 100644 --- a/src/contrib/json.c +++ b/src/contrib/json.c @@ -74,7 +74,7 @@ static void wrap(jsonw_t *w) fputc('\n', w->out); int level = MAX_DEPTH - w->top; for (int i = 0; i < level; i++) { - fprintf(w->out, "%s", w->indent); + (void)fprintf(w->out, "%s", w->indent); } } @@ -95,7 +95,7 @@ static void escaped_print(jsonw_t *w, const char *str, size_t maxlen, bool quote if (c == '\\' || c == '\"') { fputc('\\', w->out); } else if (c == '\0') { - fprintf(w->out, "\\u0000"); + (void)fprintf(w->out, "\\u0000"); continue; } fputc(c, w->out); @@ -116,7 +116,7 @@ static void align_key(jsonw_t *w, const char *key) if (key && key[0]) { escaped_print(w, key, SIZE_MAX, true); - fprintf(w->out, ": "); + (void)fprintf(w->out, ": "); } } @@ -153,7 +153,7 @@ void jsonw_null(jsonw_t *w, const char *key) assert(w); align_key(w, key); - fprintf(w->out, "null"); + (void)fprintf(w->out, "null"); } void jsonw_object(jsonw_t *w, const char *key) @@ -161,7 +161,7 @@ void jsonw_object(jsonw_t *w, const char *key) assert(w); align_key(w, key); - fprintf(w->out, "{"); + (void)fprintf(w->out, "{"); start_block(w, BLOCK_OBJECT); } @@ -170,7 +170,7 @@ void jsonw_list(jsonw_t *w, const char *key) assert(w); align_key(w, key); - fprintf(w->out, "["); + (void)fprintf(w->out, "["); start_block(w, BLOCK_LIST); } @@ -195,7 +195,7 @@ void jsonw_ulong(jsonw_t *w, const char *key, unsigned long value) assert(w); align_key(w, key); - fprintf(w->out, "%lu", value); + (void)fprintf(w->out, "%lu", value); } void jsonw_int(jsonw_t *w, const char *key, int value) @@ -203,7 +203,7 @@ void jsonw_int(jsonw_t *w, const char *key, int value) assert(w); align_key(w, key); - fprintf(w->out, "%d", value); + (void)fprintf(w->out, "%d", value); } void jsonw_double(jsonw_t *w, const char *key, double value) @@ -211,7 +211,7 @@ void jsonw_double(jsonw_t *w, const char *key, double value) assert(w); align_key(w, key); - fprintf(w->out, "%.4f", value); + (void)fprintf(w->out, "%.4f", value); } void jsonw_bool(jsonw_t *w, const char *key, bool value) @@ -219,7 +219,7 @@ void jsonw_bool(jsonw_t *w, const char *key, bool value) assert(w); align_key(w, key); - fprintf(w->out, "%s", value ? "true" : "false"); + (void)fprintf(w->out, "%s", value ? "true" : "false"); } void jsonw_hex(jsonw_t *w, const char *key, const uint8_t *data, size_t len) @@ -247,10 +247,10 @@ void jsonw_end(jsonw_t *w) switch (top->type) { case BLOCK_OBJECT: - fprintf(w->out, "}"); + (void)fprintf(w->out, "}"); break; case BLOCK_LIST: - fprintf(w->out, "]"); + (void)fprintf(w->out, "]"); break; } } diff --git a/src/knot/common/log.c b/src/knot/common/log.c index 4795ded605..cfdcb7ca3a 100644 --- a/src/knot/common/log.c +++ b/src/knot/common/log.c @@ -172,7 +172,7 @@ void log_init(void) // Publish base log sink. log_t *log = sink_setup(0); if (log == NULL) { - fprintf(stderr, "Failed to setup logging\n"); + (void)fprintf(stderr, "Failed to setup logging\n"); return; } @@ -456,7 +456,7 @@ void log_reconfigure(conf_t *conf) // Initialize logsystem. log_t *log = sink_setup(files); if (log == NULL) { - fprintf(stderr, "Failed to setup logging\n"); + (void)fprintf(stderr, "Failed to setup logging\n"); return; } diff --git a/src/knot/common/process.c b/src/knot/common/process.c index f33f3b3d22..cda00797c0 100644 --- a/src/knot/common/process.c +++ b/src/knot/common/process.c @@ -47,7 +47,7 @@ static pid_t pid_read(const char *filename) /* Read the content of the file. */ len = fread(buf, 1, sizeof(buf) - 1, fp); - fclose(fp); + (void)fclose(fp); if (len < 1) { return 0; } @@ -84,7 +84,9 @@ static int pid_write(const char *filename, pid_t pid) if (write(fd, buf, len) != len) { ret = knot_map_errno(); } - close(fd); + if (close(fd) == -1 && ret == KNOT_EOK) { + ret = knot_map_errno(); + } } else { ret = knot_map_errno(); } diff --git a/src/knot/conf/base.c b/src/knot/conf/base.c index 3a64b2b82f..b3f0fe0b76 100644 --- a/src/knot/conf/base.c +++ b/src/knot/conf/base.c @@ -868,9 +868,9 @@ static int export_group_name( return ret; } - fprintf(fp, "%s", out); + ret = (fprintf(fp, "%s", out) < 0) ? knot_map_errno() : KNOT_EOK; - return KNOT_EOK; + return ret; } static int export_group( @@ -902,7 +902,9 @@ static int export_group( if (ret != KNOT_EOK) { return ret; } - fprintf(fp, "%s", out); + if (fprintf(fp, "%s", out) < 0) { + return knot_map_errno(); + } continue; } @@ -934,7 +936,9 @@ static int export_group( if (ret != KNOT_EOK) { return ret; } - fprintf(fp, "%s", out); + if (fprintf(fp, "%s", out) < 0) { + return knot_map_errno(); + } if (values > 1) { conf_val_next(&bin); @@ -942,8 +946,8 @@ static int export_group( } } - if (*exported) { - fprintf(fp, "\n"); + if (*exported && (fprintf(fp, "\n") < 0)) { + return knot_map_errno(); } return KNOT_EOK; @@ -1030,13 +1034,17 @@ int conf_export( return knot_map_errno(); } - fprintf(fp, "# Configuration export (Knot DNS %s)\n\n", PACKAGE_VERSION); + int ret; + + if (fprintf(fp, "# Configuration export (Knot DNS %s)\n\n", + PACKAGE_VERSION) < 0) { + ret = knot_map_errno(); + goto export_error; + } const char *mod_prefix = KNOTD_MOD_NAME_PREFIX; const size_t mod_prefix_len = strlen(mod_prefix); - int ret; - // Iterate over the schema. for (yp_item_t *item = conf->schema; item->name != NULL; item++) { // Don't export module sections again. @@ -1069,8 +1077,8 @@ int conf_export( ret = KNOT_EOK; export_error: - if (file_name != NULL) { - fclose(fp); + if (file_name != NULL && fclose(fp) == -1 && ret == KNOT_EOK) { + ret = knot_map_errno(); } free(buff); @@ -1297,8 +1305,8 @@ int conf_export_schema( jsonw_end(w); jsonw_free(&w); - if (file_name != NULL) { - fclose(fp); + if (file_name != NULL && fclose(fp) == -1 && ret == KNOT_EOK) { + ret = knot_map_errno(); } return ret; diff --git a/src/knot/conf/confdb.c b/src/knot/conf/confdb.c index 4177e3e498..b079f7d8ba 100644 --- a/src/knot/conf/confdb.c +++ b/src/knot/conf/confdb.c @@ -901,29 +901,29 @@ int conf_db_raw_dump( uint8_t *k = (uint8_t *)key.data; uint8_t *d = (uint8_t *)data.data; if (k[1] == KEY1_ITEMS) { - fprintf(fp, "[%i][%i]%.*s", k[0], k[1], - (int)key.len - 2, k + 2); - fprintf(fp, ": %u\n", d[0]); + (void)fprintf(fp, "[%i][%i]%.*s", k[0], k[1], + (int)key.len - 2, k + 2); + (void)fprintf(fp, ": %u\n", d[0]); } else if (k[1] == KEY1_ID) { - fprintf(fp, "[%i][%i](%zu){", k[0], k[1], key.len - 2); + (void)fprintf(fp, "[%i][%i](%zu){", k[0], k[1], key.len - 2); for (size_t i = 2; i < key.len; i++) { - fprintf(fp, "%02x", (uint8_t)k[i]); + (void)fprintf(fp, "%02x", (uint8_t)k[i]); } - fprintf(fp, "}\n"); + (void)fprintf(fp, "}\n"); } else { - fprintf(fp, "[%i][%i]", k[0], k[1]); + (void)fprintf(fp, "[%i][%i]", k[0], k[1]); if (key.len > 2) { - fprintf(fp, "(%zu){", key.len - 2); + (void)fprintf(fp, "(%zu){", key.len - 2); for (size_t i = 2; i < key.len; i++) { - fprintf(fp, "%02x", (uint8_t)k[i]); + (void)fprintf(fp, "%02x", (uint8_t)k[i]); } - fprintf(fp, "}"); + (void)fprintf(fp, "}"); } - fprintf(fp, ": (%zu)<", data.len); + (void)fprintf(fp, ": (%zu)<", data.len); for (size_t i = 0; i < data.len; i++) { - fprintf(fp, "%02x", (uint8_t)d[i]); + (void)fprintf(fp, "%02x", (uint8_t)d[i]); } - fprintf(fp, ">\n"); + (void)fprintf(fp, ">\n"); } it = conf->api->iter_next(it); @@ -931,9 +931,9 @@ int conf_db_raw_dump( conf->api->iter_finish(it); if (file_name != NULL) { - fclose(fp); + (void)fclose(fp); } else { - fflush(fp); + (void)fflush(fp); } return ret; diff --git a/src/knot/updates/changesets.c b/src/knot/updates/changesets.c index 72334f88e2..b1e0595303 100644 --- a/src/knot/updates/changesets.c +++ b/src/knot/updates/changesets.c @@ -603,11 +603,15 @@ int changeset_print(const changeset_t *changeset, FILE *outfile, bool color) style.color = COL_RED(color); if (changeset->soa_from != NULL || !zone_contents_is_empty(changeset->remove)) { - fprintf(outfile, "%s;; Removed%s\n", style.color, COL_RST(color)); + if (fprintf(outfile, "%s;; Removed%s\n", style.color, COL_RST(color)) < 0) { + goto failed_outfile; + } } if (changeset->soa_from != NULL && buff != NULL) { ret = knot_rrset_txt_dump(changeset->soa_from, &buff, &buflen, &style); - fprintf(outfile, "%s%s%s", style.color, buff, COL_RST(color)); + if (fprintf(outfile, "%s%s%s", style.color, buff, COL_RST(color)) < 0) { + goto failed_outfile; + } } if (ret >= 0 && changeset->remove != NULL) { // Can be NULL if zone-in-journal ret = zone_dump_text(changeset->remove, NULL, outfile, false, style.color); @@ -615,11 +619,15 @@ int changeset_print(const changeset_t *changeset, FILE *outfile, bool color) style.color = COL_GRN(color); if (changeset->soa_to != NULL || !zone_contents_is_empty(changeset->add)) { - fprintf(outfile, "%s;; Added%s\n", style.color, COL_RST(color)); + if (fprintf(outfile, "%s;; Added%s\n", style.color, COL_RST(color)) < 0) { + goto failed_outfile; + } } if (changeset->soa_to != NULL && buff != NULL && ret >= 0) { ret = knot_rrset_txt_dump(changeset->soa_to, &buff, &buflen, &style); - fprintf(outfile, "%s%s%s", style.color, buff, COL_RST(color)); + if (fprintf(outfile, "%s%s%s", style.color, buff, COL_RST(color)) < 0) { + goto failed_outfile; + } } if (ret >= 0) { ret = zone_dump_text(changeset->add, NULL, outfile, false, style.color); @@ -627,4 +635,8 @@ int changeset_print(const changeset_t *changeset, FILE *outfile, bool color) free(buff); return ret >= 0 ? KNOT_EOK : ret; + +failed_outfile: + free(buff); + return knot_map_errno(); } diff --git a/src/knot/updates/zone-update.c b/src/knot/updates/zone-update.c index 2f9d7778b7..82574d197b 100644 --- a/src/knot/updates/zone-update.c +++ b/src/knot/updates/zone-update.c @@ -1019,15 +1019,21 @@ static int dump_changeset_part(zone_update_t *up, bool additions, ctx.buflen = 1024; ctx.buf = malloc(ctx.buflen); if (ctx.buf == NULL) { - fclose(ctx.f); + (void)fclose(ctx.f); return KNOT_ENOMEM; } ctx.style = KNOT_DUMP_STYLE_DEFAULT; ctx.style.now = knot_time(); - (void)fprintf(ctx.f, ";; %s records\n", additions ? "Added" : "Removed"); - int ret = zone_update_foreach(up, additions, dump_rrset, &ctx); - fclose(ctx.f); + int ret; + if (fprintf(ctx.f, ";; %s records\n", additions ? "Added" : "Removed") > 0) { + ret = zone_update_foreach(up, additions, dump_rrset, &ctx); + } else { + ret = knot_map_errno(); + } + if (fclose(ctx.f) == -1 && ret == KNOT_EOK) { + ret = knot_map_errno(); + } free(ctx.buf); return ret; } diff --git a/src/knot/zone/backup_dir.c b/src/knot/zone/backup_dir.c index 19007c0e64..75512cc39c 100644 --- a/src/knot/zone/backup_dir.c +++ b/src/knot/zone/backup_dir.c @@ -151,7 +151,9 @@ static int make_label_file(zone_backup_ctx_t *ctx) ret = (ret < 0) ? knot_map_errno() : KNOT_EOK; - fclose(file); + if (fclose(file) == -1 && ret == KNOT_EOK) { + ret = knot_map_errno(); + } return ret; } @@ -236,7 +238,7 @@ static int get_backup_format(zone_backup_ctx_t *ctx) done: free(line); - fclose(file); + (void)fclose(file); return ret; } diff --git a/src/knot/zone/zone-dump.c b/src/knot/zone/zone-dump.c index 7793922e0b..bca23cccd9 100644 --- a/src/knot/zone/zone-dump.c +++ b/src/knot/zone/zone-dump.c @@ -39,7 +39,9 @@ static int apex_node_dump_text(zone_node_t *node, dump_params_t *params) return ret; } params->rr_count += soa.rrs.count; - fprintf(params->file, "%s", params->buf); + if (fprintf(params->file, "%s", params->buf) < 0) { + return knot_map_errno(); + } params->buf[0] = '\0'; } @@ -66,7 +68,9 @@ static int apex_node_dump_text(zone_node_t *node, dump_params_t *params) return ret; } params->rr_count += rrset.rrs.count; - fprintf(params->file, "%s", params->buf); + if (fprintf(params->file, "%s", params->buf) < 0) { + return knot_map_errno(); + } params->buf[0] = '\0'; } @@ -114,7 +118,9 @@ static int node_dump_text(zone_node_t *node, void *data) // Dump block comment if available. if (params->first_comment != NULL) { - fprintf(params->file, "%s", params->first_comment); + if (fprintf(params->file, "%s", params->first_comment) < 0) { + return knot_map_errno(); + } params->first_comment = NULL; } @@ -124,7 +130,9 @@ static int node_dump_text(zone_node_t *node, void *data) return ret; } params->rr_count += rrset.rrs.count; - fprintf(params->file, "%s", params->buf); + if (fprintf(params->file, "%s", params->buf) < 0) { + return knot_map_errno(); + } params->buf[0] = '\0'; } @@ -148,7 +156,9 @@ int zone_dump_text(zone_contents_t *zone, zone_skip_t *skip, FILE *file, bool co } if (comments) { - fprintf(file, ";; Zone dump (Knot DNS %s)\n", PACKAGE_VERSION); + if (fprintf(file, ";; Zone dump (Knot DNS %s)\n", PACKAGE_VERSION) < 0) { + return knot_map_errno(); + } } // Set structure with parameters. @@ -222,12 +232,14 @@ int zone_dump_text(zone_contents_t *zone, zone_skip_t *skip, FILE *file, bool co strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S %Z", &tm); // Dump trailing statistics. - fprintf(file, ";; Written %"PRIu64" records\n" - ";; Time %s\n", - params.rr_count, date); + if (fprintf(file, ";; Written %"PRIu64" records\n" + ";; Time %s\n", + params.rr_count, date) < 0) { + ret = knot_map_errno(); + } } free(params.buf); // params.buf may be != buf because of knot_rrset_txt_dump_dynamic() - return KNOT_EOK; + return ret; } diff --git a/src/knot/zone/zonefile.c b/src/knot/zone/zonefile.c index 65f3b09f65..ed34e115ef 100644 --- a/src/knot/zone/zonefile.c +++ b/src/knot/zone/zonefile.c @@ -314,16 +314,15 @@ int zonefile_write(const char *path, zone_contents_t *zone, zone_skip_t *skip) } ret = zone_dump_text(zone, skip, file, true, NULL); - fclose(file); if (ret != KNOT_EOK) { + (void)fclose(file); unlink(tmp_name); free(tmp_name); return ret; } - /* Swap temporary zonefile and new zonefile. */ - ret = rename(tmp_name, path); - if (ret != 0) { + /* Close, then swap temporary zonefile and new zonefile. */ + if (fclose(file) == -1 || rename(tmp_name, path) == -1) { ret = knot_map_errno(); unlink(tmp_name); free(tmp_name); diff --git a/src/libknot/tsig.c b/src/libknot/tsig.c index cb05b34663..660db1760f 100644 --- a/src/libknot/tsig.c +++ b/src/libknot/tsig.c @@ -137,7 +137,7 @@ int knot_tsig_key_init_file(knot_tsig_key_t *key, const char *filename) size_t line_size = 0; ssize_t read = knot_getline(&line, &line_size, file); - fclose(file); + (void)fclose(file); if (read == -1) { return KNOT_EMALF; diff --git a/src/libknot/xdp/xdp.c b/src/libknot/xdp/xdp.c index 943d9f2f39..214675a8dd 100644 --- a/src/libknot/xdp/xdp.c +++ b/src/libknot/xdp/xdp.c @@ -579,23 +579,23 @@ void knot_xdp_socket_info(const knot_xdp_socket_t *socket, FILE *file) } #define RING_PRINFO(name, ring) \ - fprintf(file, "Ring %s: size %4d, busy %4d (prod %4d, cons %4d)\n", \ - name, (unsigned)(ring)->size, \ - (unsigned)RING_BUSY((ring)), \ - (unsigned)*(ring)->producer, (unsigned)*(ring)->consumer) + (void)fprintf(file, "Ring %s: size %4d, busy %4d (prod %4d, cons %4d)\n", \ + name, (unsigned)(ring)->size, \ + (unsigned)RING_BUSY((ring)), \ + (unsigned)*(ring)->producer, (unsigned)*(ring)->consumer) const int rx_busyf = RING_BUSY(&socket->umem->fq) + RING_BUSY(&socket->rx); - fprintf(file, "\nLOST RX frames: %4d", (int)(socket->umem->ring_size - rx_busyf)); + (void)fprintf(file, "\nLOST RX frames: %4d", (int)(socket->umem->ring_size - rx_busyf)); const int tx_busyf = RING_BUSY(&socket->umem->cq) + RING_BUSY(&socket->tx); const int tx_freef = socket->umem->tx_free_count; - fprintf(file, "\nLOST TX frames: %4d\n", (int)(socket->umem->ring_size - tx_busyf - tx_freef)); + (void)fprintf(file, "\nLOST TX frames: %4d\n", (int)(socket->umem->ring_size - tx_busyf - tx_freef)); RING_PRINFO("FQ", &socket->umem->fq); RING_PRINFO("RX", &socket->rx); RING_PRINFO("TX", &socket->tx); RING_PRINFO("CQ", &socket->umem->cq); - fprintf(file, "TX free frames: %4d\n", tx_freef); + (void)fprintf(file, "TX free frames: %4d\n", tx_freef); } _public_ diff --git a/src/utils/common/resolv.c b/src/utils/common/resolv.c index 78a68ef9be..94567c8e85 100644 --- a/src/utils/common/resolv.c +++ b/src/utils/common/resolv.c @@ -163,7 +163,7 @@ static size_t get_resolv_nameservers(list_t *servers, const char *def_port) } // Close config file. - fclose(f); + (void)fclose(f); // Return number of servers. return list_size(servers); diff --git a/src/utils/knotd/main.c b/src/utils/knotd/main.c index a814e1a55f..4c10e4add8 100644 --- a/src/utils/knotd/main.c +++ b/src/utils/knotd/main.c @@ -544,7 +544,7 @@ int main(int argc, char **argv) /* Now check if we want to daemonize. */ if (daemonize) { if (make_daemon(1, 0) != 0) { - fprintf(stderr, "Daemonization failed, shutting down...\n"); + (void)fprintf(stderr, "Daemonization failed, shutting down...\n"); return EXIT_FAILURE; } } diff --git a/src/utils/knsupdate/knsupdate_exec.c b/src/utils/knsupdate/knsupdate_exec.c index a30ac08d26..8ca0e69c60 100644 --- a/src/utils/knsupdate/knsupdate_exec.c +++ b/src/utils/knsupdate/knsupdate_exec.c @@ -577,7 +577,7 @@ int knsupdate_exec(knsupdate_params_t *params) break; } ret = process_lines(params, fp); - fclose(fp); + (void)fclose(fp); if (ret != KNOT_EOK) { break; } diff --git a/src/utils/kxdpgun/load_queries.c b/src/utils/kxdpgun/load_queries.c index fabb4f3abb..77fbe90ccf 100644 --- a/src/utils/kxdpgun/load_queries.c +++ b/src/utils/kxdpgun/load_queries.c @@ -219,12 +219,12 @@ bool load_queries(const input_t *input, uint16_t edns_size, uint16_t msgid, size } free(bufs); - fclose(f); + (void)fclose(f); return true; fail: free_global_payloads(); free(bufs); - fclose(f); + (void)fclose(f); return false; } diff --git a/src/utils/kzonecheck/zone_check.c b/src/utils/kzonecheck/zone_check.c index 6a6c59e104..edba74f8cf 100644 --- a/src/utils/kzonecheck/zone_check.c +++ b/src/utils/kzonecheck/zone_check.c @@ -35,9 +35,9 @@ static void err_callback(sem_handler_t *handler, const zone_contents_t *zone, owner = ""; } - fprintf(stderr, "[%s] %s%s%s\n", owner, sem_error_msg(error), - (data != NULL ? " " : ""), - (data != NULL ? data : "")); + (void)fprintf(stderr, "[%s] %s%s%s\n", owner, sem_error_msg(error), + (data != NULL ? " " : ""), + (data != NULL ? data : "")); stats->errors[error]++; stats->error_count++; @@ -45,10 +45,10 @@ static void err_callback(sem_handler_t *handler, const zone_contents_t *zone, static void print_statistics(err_handler_stats_t *stats) { - fprintf(stderr, "\nError summary:\n"); + (void)fprintf(stderr, "\nError summary:\n"); for (sem_error_t i = 0; i <= SEM_ERR_UNKNOWN; ++i) { if (stats->errors[i] > 0) { - fprintf(stderr, "%4u\t%s\n", stats->errors[i], sem_error_msg(i)); + (void)fprintf(stderr, "%4u\t%s\n", stats->errors[i], sem_error_msg(i)); } } } @@ -96,7 +96,7 @@ int zone_check(const char *zone_file, const knot_dname_t *zone_name, bool zonemd if (stats.error_count > 0) { print_statistics(&stats); if (stats.handler.error) { - fprintf(stderr, "\n"); + (void)fprintf(stderr, "\n"); ERR2("serious semantic error detected"); ret = KNOT_EINVAL; } else { @@ -108,7 +108,7 @@ int zone_check(const char *zone_file, const knot_dname_t *zone_name, bool zonemd ret = zone_contents_digest_verify(contents); if (ret != KNOT_EOK) { if (stats.error_count > 0 && !stats.handler.error) { - fprintf(stderr, "\n"); + (void)fprintf(stderr, "\n"); } ERR2("invalid ZONEMD"); } @@ -116,7 +116,7 @@ int zone_check(const char *zone_file, const knot_dname_t *zone_name, bool zonemd if (print) { if (ret != KNOT_EOK) { - fprintf(stderr, "\n"); + (void)fprintf(stderr, "\n"); } printf(";; Zone dump (Knot DNS %s)\n", PACKAGE_VERSION); zone_dump_text(contents, NULL, stdout, false, NULL);