aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_install/add/extract.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/pkg_install/add/extract.c')
-rw-r--r--usr.sbin/pkg_install/add/extract.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/pkg_install/add/extract.c b/usr.sbin/pkg_install/add/extract.c
index 84160f74d66b..997d6d8d094b 100644
--- a/usr.sbin/pkg_install/add/extract.c
+++ b/usr.sbin/pkg_install/add/extract.c
@@ -52,7 +52,12 @@ extract_plist(char *home, Package *pkg)
if (Verbose)
printf("extract: %s/%s\n", Directory, p->name);
if (!Fake) {
- copy_hierarchy(Directory, p->name, TRUE);
+ char try[FILENAME_MAX];
+
+ /* first try to rename it into place */
+ sprintf(try, "%s/%s", Directory, p->name);
+ if (rename(p->name, try) == FAIL)
+ copy_hierarchy(Directory, p->name, TRUE);
apply_perms(Directory, p->name);
}
break;