summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-10-27 22:53:33 +0000
committerache <ache@FreeBSD.org>1997-10-27 22:53:33 +0000
commit5865a758bc78459ebe30511ab97dd81b2aa8597f (patch)
tree1e07ec5ee5a69ad2271786b950c54ad3f351dc54
parente69d3597cb87daaa8e4173388d4d6000247df8fe (diff)
downloadFreeBSD-src-5865a758bc78459ebe30511ab97dd81b2aa8597f.zip
FreeBSD-src-5865a758bc78459ebe30511ab97dd81b2aa8597f.tar.gz
1) Ignore -C with -d, not fail (for $(INSTALL) macro from /etc/make.conf)
2) When uid/gid not specified, not try to set 0:0 owner, just do nothing. It makes possible to use install -d by users without setting their uid:gid each time. 3) Be more specific where install_dir fails
-rw-r--r--usr.bin/xinstall/xinstall.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
index 2889bab..d7f607a 100644
--- a/usr.bin/xinstall/xinstall.c
+++ b/usr.bin/xinstall/xinstall.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "From: @(#)xinstall.c 8.1 (Berkeley) 7/21/93";
#endif
static const char rcsid[] =
- "$Id: xinstall.c,v 1.24 1997/08/27 06:29:23 charnier Exp $";
+ "$Id: xinstall.c,v 1.25 1997/09/14 08:21:44 peter Exp $";
#endif /* not lint */
/*-
@@ -109,8 +109,8 @@ int trymmap __P((int));
#define ALLOW_NUMERIC_IDS 1
#ifdef ALLOW_NUMERIC_IDS
-uid_t uid;
-gid_t gid;
+uid_t uid = -1;
+gid_t gid = -1;
uid_t resolve_uid __P((char *));
gid_t resolve_gid __P((char *));
@@ -185,7 +185,7 @@ main(argc, argv)
argv += optind;
/* some options make no sense when creating directories */
- if ((docompare || dostrip) && dodir)
+ if (dostrip && dodir)
usage();
/* must have at least two arguments, except when creating directories */
@@ -670,7 +670,7 @@ install_dir(path)
*p = '\0';
if (stat(path, &sb)) {
if (errno != ENOENT || mkdir(path, 0777) < 0) {
- err(EX_OSERR, "%s", path);
+ err(EX_OSERR, "mkdir %s", path);
/* NOTREACHED */
}
}
@@ -678,10 +678,10 @@ install_dir(path)
break;
}
- if (((gid != (gid_t)-1 || uid != (uid_t)-1) && chown(path, uid, gid)) ||
- chmod(path, mode)) {
- warn("%s", path);
- }
+ if ((gid != (gid_t)-1 || uid != (uid_t)-1) && chown(path, uid, gid))
+ warn("chown %u:%u %s", uid, gid, path);
+ else if (chmod(path, mode))
+ warn("chmod %o %s", mode, path);
}
/*
OpenPOWER on IntegriCloud