summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorcypherpunks <cypherpunks@torproject.org>2017-08-03 19:45:46 +0000
committerNick Mathewson <nickm@torproject.org>2017-08-04 12:22:53 -0400
commitbfe740f0658dc05e9cc624a46ae21bb098117197 (patch)
tree6753b8ef70bd675928ed3d76cab7e7d564d4be55 /configure.ac
parent0265ced02b7a652c5941cb2c14ee1e0de0b1d90e (diff)
downloadtor-bfe740f0658dc05e9cc624a46ae21bb098117197.tar.gz
tor-bfe740f0658dc05e9cc624a46ae21bb098117197.zip
Refactor retrieving the current working directory
The GNU C Library (glibc) offers an function which allocates the necessary memory automatically [0]. When it is available, we use that. Otherwise we depend upon the `getcwd` function which requires a preallocated buffer (and its size). This function was used incorrectly by depending on the initial buffer size being big enough and otherwise failing to return the current working directory. The proper way of getting the current working directory requires a loop which doubles the buffer size if `getcwd` requires it. This code was copied from [1] with modifications to fit the context. [0] https://www.gnu.org/software/hurd/hurd/porting/guidelines.html [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac1
1 files changed, 1 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 4092d10af6..345e499ffc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -481,6 +481,7 @@ AC_CHECK_FUNCS(
timingsafe_memcmp \
flock \
ftime \
+ get_current_dir_name \
getaddrinfo \
getifaddrs \
getpass \