From: Nick Mathewson Date: Thu, 31 May 2012 20:21:54 +0000 (-0400) Subject: Merge remote-tracking branch 'public/bug5089' X-Git-Tag: tor-0.2.3.16-alpha~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dff73d26f3a6c9d7011ad98a6752129a37625a10;p=thirdparty%2Ftor.git Merge remote-tracking branch 'public/bug5089' Conflicts: src/test/test_util.c Merge the unit tests; I added some when I did this branch against 0.2.2, and then the test format changed and master added more tests. --- dff73d26f3a6c9d7011ad98a6752129a37625a10 diff --cc src/common/compat.c index 59c7ca4c5a,ffd9724824..093106120d --- a/src/common/compat.c +++ b/src/common/compat.c @@@ -1678,9 -1507,9 +1682,9 @@@ get_parent_directory(char *fname */ cp = fname + strlen(fname); at_end = 1; - while (--cp > fname) { + while (--cp >= fname) { int is_sep = (*cp == '/' -#ifdef MS_WINDOWS +#ifdef _WIN32 || *cp == '\\' #endif ); diff --cc src/test/test_util.c index 99c5544508,a393079e14..e05269252b --- a/src/test/test_util.c +++ b/src/test/test_util.c @@@ -2080,35 -1297,17 +2080,31 @@@ test_util_parent_dir(void *ptr tor_free(cp); \ } while (0); - 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("/home/wombat", 0, "/home/wombat/knish"); + T("/home/wombat", 0, "/home/wombat/knish/"); + T("/home/wombat", 0, "/home/wombat/knish///"); + T("./home/wombat", 0, "./home/wombat/knish/"); - #if 0 + T("/", 0, "/home"); + T("/", 0, "/home//"); - #endif + T(".", 0, "./wombat"); + T(".", 0, "./wombat/"); + T(".", 0, "./wombat//"); + T("wombat", 0, "wombat/foo"); + T("wombat/..", 0, "wombat/../foo"); + T("wombat/../", 0, "wombat/..//foo"); /* Is this correct? */ + T("wombat/.", 0, "wombat/./foo"); + T("wombat/./", 0, "wombat/.//foo"); /* Is this correct? */ + T("wombat", 0, "wombat/..//"); + T("wombat", 0, "wombat/foo/"); + T("wombat", 0, "wombat/.foo"); + T("wombat", 0, "wombat/.foo/"); + - T("", -1, ""); - T("", -1, "."); - T("", -1, ".."); - T("", -1, "../"); - T("", -1, "/"); - T("", -1, "////"); - T("", -1, "wombat"); - T("", -1, "wombat/"); + T("wombat", -1, ""); + T("w", -1, ""); - T("wombat/knish", 0, "wombat"); - T("", -1, ""); ++ T("wombat", 0, "wombat/knish"); ++ + T("/", 0, "/"); - T("////", 0, "/"); ++ T("/", 0, "////"); done: tor_free(cp);