diff options
author | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2005-09-24 22:27:18 +0000 |
---|---|---|
committer | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2005-09-24 22:27:18 +0000 |
commit | 825484e638ce04c343c7f7d5f96fe109f03f51f9 (patch) | |
tree | 2e183b6c56e811ffae881455333750e82ade1990 /test | |
parent | cc7e151cd517e31f5ee1af0820ab182f7ff356ae (diff) | |
download | libapr-825484e638ce04c343c7f7d5f96fe109f03f51f9.tar.gz |
Merge r291339 from trunk:
* file_io/unix/dir.c (apr_dir_make_recursive): Fix infinite recursion
if mkdir fails for all path components.
* test/testdir.c (test_rmkdir_nocwd): Add test case.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/0.9.x@291341 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r-- | test/testdir.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/testdir.c b/test/testdir.c index 1e2227473..e1b08425e 100644 --- a/test/testdir.c +++ b/test/testdir.c @@ -219,6 +219,29 @@ static void test_uncleared_errno(CuTest *tc) } +static void test_rmkdir_nocwd(CuTest *tc) +{ + char *cwd, *path; + + apr_assert_success(tc, "make temp dir", + apr_dir_make("dir3", APR_OS_DEFAULT, p)); + + apr_assert_success(tc, "obtain cwd", apr_filepath_get(&cwd, 0, p)); + + apr_assert_success(tc, "determine path to temp dir", + apr_filepath_merge(&path, cwd, "dir3", 0, p)); + + apr_assert_success(tc, "change to temp dir", apr_filepath_set(path, p)); + + apr_assert_success(tc, "remove temp dir", apr_dir_remove(path, p)); + + CuAssert(tc, "fail to create dir", + apr_dir_make_recursive("foobar", APR_OS_DEFAULT, + p) != APR_SUCCESS); + + apr_assert_success(tc, "restore cwd", apr_filepath_set(cwd, p)); +} + CuSuite *testdir(void) { CuSuite *suite = CuSuiteNew("Directory"); @@ -230,6 +253,7 @@ CuSuite *testdir(void) SUITE_ADD_TEST(suite, test_removeall); SUITE_ADD_TEST(suite, test_remove_notthere); SUITE_ADD_TEST(suite, test_mkdir_twice); + SUITE_ADD_TEST(suite, test_rmkdir_nocwd); SUITE_ADD_TEST(suite, test_rewind); |