diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-05-24 12:56:31 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-05-24 12:56:31 -0400 |
commit | 254504fc1494b1ca4eea14eb71bd5b4b5d0d2765 (patch) | |
tree | 1c856a23e6cb89a5cd81c9459f47ce98fd9a9596 /src/test/test_util.c | |
parent | 75fc4dbbcabaedc715f0f9e883ccab1c9634e787 (diff) | |
download | tor-254504fc1494b1ca4eea14eb71bd5b4b5d0d2765.tar.gz tor-254504fc1494b1ca4eea14eb71bd5b4b5d0d2765.zip |
Have get_parent_directory() handle "/foo" and "/" correctly.
The parent of "/foo" is "/"; and "/" is its own parent.
This would cause Tor to fail if you tried to have a PF_UNIX control
socket in the root directory. That would be a stupid thing to do
for other reasons, but there's no reason to fail like _this_.
Bug found by Esteban Manchado Velázquez. Fix for bug 5089; bugfix on
Tor 0.2.2.26-beta. Unit test included.
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r-- | src/test/test_util.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index f9a83a38a5..1c7c2fec23 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -1299,11 +1299,12 @@ test_util_parent_dir(void *ptr) T("/home/wombat/knish", 0, "/home/wombat"); T("/home/wombat/knish/", 0, "/home/wombat"); + T("/home", 0, "/"); T("./home/wombat/knish/", 0, "./home/wombat"); T("./wombat", 0, "."); T("", -1, ""); - T("/", -1, ""); - T("////", -1, ""); + T("/", 0, "/"); + T("////", 0, "/"); done: tor_free(cp); |