From: Roger Dingledine Date: Fri, 23 Jul 2004 21:25:28 +0000 (+0000) Subject: check return value of fclose while writing to disk, since it might X-Git-Tag: tor-0.0.8pre2~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5525606653bbfa2e5aa14dbe2ecf8e32b81c99cf;p=thirdparty%2Ftor.git check return value of fclose while writing to disk, since it might return out-of-space, etc svn:r2122 --- diff --git a/src/common/util.c b/src/common/util.c index be4f60028a..5ccc58aede 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1334,7 +1334,10 @@ write_str_to_file(const char *fname, const char *str) fclose(file); return -1; } - fclose(file); + if (fclose(file) == EOF) { + log(LOG_WARN,"Error flushing to %s: %s", tempname, strerror(errno)); + return -1; + } #ifdef MS_WINDOWS /* On Windows, rename doesn't replace. We could call ReplaceFile, but