Skip to content

Commit

Permalink
1) Ignore -C with -d, not fail (for $(INSTALL) macro from /etc/make.c…
Browse files Browse the repository at this point in the history
…onf)

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
  • Loading branch information
Andrey A. Chernov authored and Andrey A. Chernov committed Oct 27, 1997
1 parent 87b7ee4 commit cf57a56
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions usr.bin/xinstall/xinstall.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

/*-
Expand Down Expand Up @@ -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 *));
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -670,18 +670,18 @@ 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 */
}
}
if (!(*p = ch))
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);
}

/*
Expand Down

0 comments on commit cf57a56

Please sign in to comment.