aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-06-10 18:08:56 +0000
committerNick Mathewson <nickm@torproject.org>2008-06-10 18:08:56 +0000
commitd0a4ad3a1cda334f5213b5abdd4d15483d3eb805 (patch)
tree262dd58b46d1760983d9759b58150bc90ee00d49 /src/common/util.c
parentf4e12fa66db7d3b1d621aaf3396c080aac573a02 (diff)
downloadtor-d0a4ad3a1cda334f5213b5abdd4d15483d3eb805.tar.gz
tor-d0a4ad3a1cda334f5213b5abdd4d15483d3eb805.zip
r16127@tombo: nickm | 2008-06-10 14:03:01 -0400
Improved code for counting clients by country: support recording by number of directory status requests in addition to number of IPs seen. svn:r15097
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/common/util.c b/src/common/util.c
index a048779872..17962fc723 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1604,8 +1604,8 @@ fdopen_file(open_file_t *file_data)
return file_data->stdio_file;
tor_assert(file_data->fd >= 0);
if (!(file_data->stdio_file = fdopen(file_data->fd, "a"))) {
- log_warn(LD_FS, "Couldn't fdopen \"%s\": %s", file_data->filename,
- strerror(errno));
+ log_warn(LD_FS, "Couldn't fdopen \"%s\" [%d]: %s", file_data->filename,
+ file_data->fd, strerror(errno));
}
return file_data->stdio_file;
}
@@ -1619,8 +1619,10 @@ start_writing_to_stdio_file(const char *fname, int open_flags, int mode,
FILE *res;
if (start_writing_to_file(fname, open_flags, mode, data_out)<0)
return NULL;
- if (!(res = fdopen_file(*data_out)))
+ if (!(res = fdopen_file(*data_out))) {
abort_writing_to_file(*data_out);
+ *data_out = NULL;
+ }
return res;
}