summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_install/add/futil.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/pkg_install/add/futil.c')
-rw-r--r--usr.sbin/pkg_install/add/futil.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/usr.sbin/pkg_install/add/futil.c b/usr.sbin/pkg_install/add/futil.c
index 78d2bc676e9..52a8e07dbdc 100644
--- a/usr.sbin/pkg_install/add/futil.c
+++ b/usr.sbin/pkg_install/add/futil.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: futil.c,v 1.4 1998/09/07 22:30:13 marc Exp $ */
+/* $OpenBSD: futil.c,v 1.5 1999/06/24 17:27:11 espie Exp $ */
#ifndef lint
-static const char *rcsid = "$OpenBSD: futil.c,v 1.4 1998/09/07 22:30:13 marc Exp $";
+static const char *rcsid = "$OpenBSD: futil.c,v 1.5 1999/06/24 17:27:11 espie Exp $";
#endif
/*
@@ -74,21 +74,17 @@ apply_perms(char *dir, char *arg)
else
cd_to = dir;
+ if (Owner || Group) {
+ char *real_owner = Owner ? Owner : "";
+ char *real_group = Group ? Group : "";
+
+ if (vsystem("cd %s && chown -R %s:%s %s", cd_to, real_owner ,
+ real_group, arg))
+ warnx("couldn't change owner/group of '%s' to '%s:%s'",
+ arg, real_owner, real_group);
+ }
if (Mode)
if (vsystem("cd %s && chmod -R %s %s", cd_to, Mode, arg))
warnx("couldn't change modes of '%s' to '%s'", arg, Mode);
- if (Owner && Group) {
- if (vsystem("cd %s && chown -R %s.%s %s", cd_to, Owner, Group, arg))
- warnx("couldn't change owner/group of '%s' to '%s.%s'",
- arg, Owner, Group);
- return;
- }
- if (Owner) {
- if (vsystem("cd %s && chown -R %s %s", cd_to, Owner, arg))
- warnx("couldn't change owner of '%s' to '%s'", arg, Owner);
- return;
- } else if (Group)
- if (vsystem("cd %s && chgrp -R %s %s", cd_to, Group, arg))
- warnx("couldn't change group of '%s' to '%s'", arg, Group);
}