summaryrefslogtreecommitdiff
path: root/test/testdir.c
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2005-09-24 22:09:35 +0000
committerJoe Orton <jorton@apache.org>2005-09-24 22:09:35 +0000
commitc002190265dab7c405dc61e4ecac00f8b4c8b319 (patch)
treef426e4174fb9242a858af73b46388ed9db253264 /test/testdir.c
parent7216d4044b98d1deb6ec647312bb3582550bae6e (diff)
downloadapr-c002190265dab7c405dc61e4ecac00f8b4c8b319.tar.gz
* 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: https://svn.apache.org/repos/asf/apr/apr/trunk@291339 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testdir.c')
-rw-r--r--test/testdir.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/testdir.c b/test/testdir.c
index bc2ca9ae6..f59e3e60e 100644
--- a/test/testdir.c
+++ b/test/testdir.c
@@ -219,6 +219,30 @@ static void test_uncleared_errno(abts_case *tc, void *data)
}
+static void test_rmkdir_nocwd(abts_case *tc, void *data)
+{
+ 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));
+
+ ABTS_ASSERT(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));
+}
+
+
abts_suite *testdir(abts_suite *suite)
{
suite = ADD_SUITE(suite)
@@ -230,6 +254,7 @@ abts_suite *testdir(abts_suite *suite)
abts_run_test(suite, test_removeall, NULL);
abts_run_test(suite, test_remove_notthere, NULL);
abts_run_test(suite, test_mkdir_twice, NULL);
+ abts_run_test(suite, test_rmkdir_nocwd, NULL);
abts_run_test(suite, test_rewind, NULL);