From: Bruno Haible Date: Tue, 27 Oct 2009 23:51:42 +0000 (+0100) Subject: Avoid warning despite dropping the return value of fwrite. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97b954ff1a428ff32f0be07f99a95a2dd58aa8e9;p=pspp Avoid warning despite dropping the return value of fwrite. --- diff --git a/ChangeLog b/ChangeLog index 0897109f2f..20c0e56fc9 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 781621c6f2..b6fd658ee7 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 45be9fd9ff..8231569c67 100644 --- a/modules/unicodeio +++ b/modules/unicodeio @@ -13,6 +13,7 @@ iconv_open gettext-h localcharset error +ignore-value configure.ac: gl_UNICODEIO