aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-07-23 21:25:28 +0000
committerRoger Dingledine <arma@torproject.org>2004-07-23 21:25:28 +0000
commit5525606653bbfa2e5aa14dbe2ecf8e32b81c99cf (patch)
treecc95c0392a84c0844f5292e7c0a37945870f9187 /src/common/util.c
parente4ae4f43dd808b6e2928deb8877fc969986aba2e (diff)
downloadtor-5525606653bbfa2e5aa14dbe2ecf8e32b81c99cf.tar
tor-5525606653bbfa2e5aa14dbe2ecf8e32b81c99cf.tar.gz
check return value of fclose while writing to disk, since it might
return out-of-space, etc svn:r2122
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/common/util.c b/src/common/util.c
index be4f60028..5ccc58aed 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