[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Remove uncompilable tor_mmap_file fallback. #25398



commit 45d3b5fa4cd1ee2bdcbefcf5a33073b301733e46
Author: Alex Xu (Hello71) <alex_y_xu@xxxxxxxx>
Date:   Fri Mar 2 09:49:35 2018 -0500

    Remove uncompilable tor_mmap_file fallback. #25398
---
 changes/bug25398    |  2 ++
 src/common/compat.c | 36 ++----------------------------------
 2 files changed, 4 insertions(+), 34 deletions(-)

diff --git a/changes/bug25398 b/changes/bug25398
new file mode 100644
index 000000000..5f3fd7f5e
--- /dev/null
+++ b/changes/bug25398
@@ -0,0 +1,2 @@
+  o Minor bugfixes (portability):
+    - Remove uncompilable tor_mmap_file fallback. Fixes bug 25398.
diff --git a/src/common/compat.c b/src/common/compat.c
index e8916c8d1..9457b8289 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -417,40 +417,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



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits