summaryrefslogtreecommitdiff
path: root/src/common/compat.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-03-28 14:47:05 -0400
committerNick Mathewson <nickm@torproject.org>2018-03-28 14:47:05 -0400
commit2f872f9762128228e98f74bf7cb53aed54aee088 (patch)
tree42a1371f80d82136a5c77e92aad734b6c23f3960 /src/common/compat.c
parent4c0e434f33d937f43b49dc707718d73e5aea23b7 (diff)
parent45d3b5fa4cd1ee2bdcbefcf5a33073b301733e46 (diff)
downloadtor-2f872f9762128228e98f74bf7cb53aed54aee088.tar.gz
tor-2f872f9762128228e98f74bf7cb53aed54aee088.zip
Merge remote-tracking branch 'hello71/bug25398'
Diffstat (limited to 'src/common/compat.c')
-rw-r--r--src/common/compat.c36
1 files changed, 2 insertions, 34 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index 99a7b8c0c1..693fca70ea 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -402,40 +402,8 @@ tor_munmap_file(tor_mmap_t *handle)
return 0;
}
#else
-tor_mmap_t *
-tor_mmap_file(const char *filename)
-{
- struct stat st;
- char *res = read_file_to_str(filename, RFTS_BIN|RFTS_IGNORE_MISSING, &st);
- tor_mmap_t *handle;
- if (! res)
- return NULL;
- handle = tor_malloc_zero(sizeof(tor_mmap_t));
- handle->data = res;
- handle->size = st.st_size;
- return handle;
-}
-
-/** Unmap the file mapped with tor_mmap_file(), and return 0 for success
- * or -1 for failure.
- */
-
-int
-tor_munmap_file(tor_mmap_t *handle)
-{
- char *d = NULL;
- if (handle == NULL)
- return 0;
-
- d = (char*)handle->data;
- tor_free(d);
- memwipe(handle, 0, sizeof(tor_mmap_t));
- tor_free(handle);
-
- /* Can't fail in this mmap()/munmap()-free case */
- return 0;
-}
-#endif /* defined(COMPAT_HAS_MMAN_AND_PAGESIZE) || ... || ... */
+#error "cannot implement tor_mmap_file"
+#endif /* defined(HAVE_MMAP) || ... || ... */
/** Replacement for snprintf. Differs from platform snprintf in two
* ways: First, always NUL-terminates its output. Second, always