summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>1999-06-24 17:27:12 +0000
committerMarc Espie <espie@cvs.openbsd.org>1999-06-24 17:27:12 +0000
commit062e01f18eb19faffaf6856ae9440c6ae38e197c (patch)
treece11b92d5e47fcb31fde8496f422287669fc083f
parentc18004236df23c7d8ec0a4000688b9561f59284c (diff)
- let chmod work for suid (move it in front of chown).
- use the new form of chown, with user:group instead of user.group.
-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);
}