summaryrefslogtreecommitdiff
path: root/src/common/compat.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-02-01 18:09:27 +0000
committerNick Mathewson <nickm@torproject.org>2007-02-01 18:09:27 +0000
commit5cb99857bc0633757f60c4b964359c5a03121b28 (patch)
tree707a2ad60ab69f54eb9e4716d0fa9df50c77686f /src/common/compat.c
parent8a9a55251ffe14389a96e99bdcc7af59b0f1c8ba (diff)
downloadtor-5cb99857bc0633757f60c4b964359c5a03121b28.tar.gz
tor-5cb99857bc0633757f60c4b964359c5a03121b28.zip
r11620@catbus: nickm | 2007-02-01 13:06:27 -0500
Call stat() slightly less often; use fstat() when possible. svn:r9472
Diffstat (limited to 'src/common/compat.c')
-rw-r--r--src/common/compat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index 6838db9043..9c9da66d6b 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -241,14 +241,14 @@ tor_munmap_file(tor_mmap_t *handle)
tor_mmap_t *
tor_mmap_file(const char *filename)
{
- size_t size;
- char *res = read_file_to_str(filename, 1, &size);
+ struct stat st;
+ char *res = read_file_to_str(filename, 1, &st);
tor_mmap_t *handle;
if (! res)
return NULL;
handle = tor_malloc_zero(sizeof(tor_mmap_t));
handle->data = res;
- handle->size = size;
+ handle->size = st.st_size;
return handle;
}
void