1. If checking for directory-ness, check "dir" and "dir/" to catch

the case where we have a symlink pointing at a dir.

2. Restore stomped character before returning in make_hierarchy()
This commit is contained in:
Jordan K. Hubbard 2000-02-19 08:52:52 +00:00
parent 3b006d8ebd
commit 95452c412e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=57330

View File

@ -45,12 +45,18 @@ make_hierarchy(char *dir)
if ((cp2 = index(cp1, '/')) !=NULL ) if ((cp2 = index(cp1, '/')) !=NULL )
*cp2 = '\0'; *cp2 = '\0';
if (fexists(dir)) { if (fexists(dir)) {
if (!isdir(dir)) if (!isdir(dir)) {
if (cp2)
*cp2 = '/';
return FAIL; return FAIL;
}
} }
else { else {
if (vsystem("mkdir %s", dir)) if (vsystem("mkdir %s", dir)) {
if (cp2)
*cp2 = '/';
return FAIL; return FAIL;
}
apply_perms(NULL, dir); apply_perms(NULL, dir);
} }
/* Put it back */ /* Put it back */