From c8f3efebcbd02d389b02f9fc58d46e955c0169e0 Mon Sep 17 00:00:00 2001 From: jkh Date: Sat, 19 Feb 2000 08:52:52 +0000 Subject: 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() --- usr.sbin/pkg_install/add/futil.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'usr.sbin/pkg_install') diff --git a/usr.sbin/pkg_install/add/futil.c b/usr.sbin/pkg_install/add/futil.c index e68d817..075095f 100644 --- a/usr.sbin/pkg_install/add/futil.c +++ b/usr.sbin/pkg_install/add/futil.c @@ -45,12 +45,18 @@ make_hierarchy(char *dir) if ((cp2 = index(cp1, '/')) !=NULL ) *cp2 = '\0'; if (fexists(dir)) { - if (!isdir(dir)) + if (!isdir(dir)) { + if (cp2) + *cp2 = '/'; return FAIL; + } } else { - if (vsystem("mkdir %s", dir)) + if (vsystem("mkdir %s", dir)) { + if (cp2) + *cp2 = '/'; return FAIL; + } apply_perms(NULL, dir); } /* Put it back */ -- cgit v1.1