From 97b954ff1a428ff32f0be07f99a95a2dd58aa8e9 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 28 Oct 2009 00:51:42 +0100 Subject: [PATCH] Avoid warning despite dropping the return value of fwrite. --- ChangeLog | 8 ++++++++ lib/unicodeio.c | 9 +++++++-- modules/unicodeio | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0897109f2..20c0e56fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-10-27 Jim Meyering + Bruno Haible + + Avoid warning despite dropping the return value of fwrite. + * lib/unicodeio.c: Include ignore-value.h. + (fwrite_success_callback): Explicitly ignore fwrite's return value. + * modules/unicodeio (Depends-on): Add ignore-value. + 2009-10-26 Eric Blake areadlinkat: fix fallback path diff --git a/lib/unicodeio.c b/lib/unicodeio.c index 781621c6f..b6fd658ee 100644 --- a/lib/unicodeio.c +++ b/lib/unicodeio.c @@ -1,6 +1,6 @@ /* Unicode character output to streams with locale dependent encoding. - Copyright (C) 2000-2003, 2006, 2008 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2006, 2008-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,6 +38,7 @@ #include "localcharset.h" #include "unistr.h" +#include "ignore-value.h" /* When we pass a Unicode character to iconv(), we must pass it in a suitable encoding. The standardized Unicode encodings are @@ -162,7 +163,11 @@ fwrite_success_callback (const char *buf, size_t buflen, void *callback_arg) { FILE *stream = (FILE *) callback_arg; - fwrite (buf, 1, buflen, stream); + /* The return value of fwrite can be ignored here, because under normal + conditions (STREAM is an open stream and not wide-character oriented) + when fwrite() returns a value != buflen it also sets STREAM's error + indicator. */ + ignore_value (fwrite (buf, 1, buflen, stream)); return 0; } diff --git a/modules/unicodeio b/modules/unicodeio index 45be9fd9f..8231569c6 100644 --- a/modules/unicodeio +++ b/modules/unicodeio @@ -13,6 +13,7 @@ iconv_open gettext-h localcharset error +ignore-value configure.ac: gl_UNICODEIO -- 2.11.0