Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149214937
D14626.1789688172.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D14626.1789688172.diff
View Options
Index: usr.bin/xinstall/install.1
===================================================================
--- usr.bin/xinstall/install.1
+++ usr.bin/xinstall/install.1
@@ -28,7 +28,7 @@
.\" From: @(#)install.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
-.Dd January 18, 2013
+.Dd March 3, 2018
.Dt INSTALL 1
.Os
.Sh NAME
@@ -36,7 +36,7 @@
.Nd install binaries
.Sh SYNOPSIS
.Nm
-.Op Fl bCcpSsUv
+.Op Fl bCcepSsUv
.Op Fl B Ar suffix
.Op Fl D Ar destdir
.Op Fl f Ar flags
@@ -50,7 +50,7 @@
.Op Fl T Ar tags
.Ar file1 file2
.Nm
-.Op Fl bCcpSsUv
+.Op Fl bCcepSsUv
.Op Fl B Ar suffix
.Op Fl D Ar destdir
.Op Fl f Ar flags
@@ -65,7 +65,7 @@
.Ar file1 ... fileN directory
.Nm
.Fl d
-.Op Fl Uv
+.Op Fl eUv
.Op Fl D Ar destdir
.Op Fl g Ar group
.Op Fl h Ar hash
@@ -124,6 +124,10 @@
The
.Fl c
option is only included for backwards compatibility.
+.It Fl e
+If specified owner or modes can't be set, fail with an error code.
+.Nm
+normally just warns if it can't set owner or mode and does not set an error code.
.It Fl D Ar destdir
Specify the
.Ev DESTDIR
Index: usr.bin/xinstall/xinstall.c
===================================================================
--- usr.bin/xinstall/xinstall.c
+++ usr.bin/xinstall/xinstall.c
@@ -109,8 +109,8 @@
static gid_t gid;
static uid_t uid;
-static int dobackup, docompare, dodir, dolink, dopreserve, dostrip, dounpriv,
- safecopy, verbose;
+static int dobackup, docompare, dodir, doerror, dolink, dopreserve, dostrip,
+ dounpriv, safecopy, verbose;
static int haveopt_f, haveopt_g, haveopt_m, haveopt_o;
static mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
static FILE *metafp;
@@ -154,7 +154,7 @@
fset = 0;
iflags = 0;
group = owner = NULL;
- while ((ch = getopt(argc, argv, "B:bCcD:df:g:h:l:M:m:N:o:pSsT:Uv")) !=
+ while ((ch = getopt(argc, argv, "B:bCcD:def:g:h:l:M:m:N:o:pSsT:Uv")) !=
-1)
switch((char)ch) {
case 'B':
@@ -175,6 +175,9 @@
case 'd':
dodir = 1;
break;
+ case 'e':
+ doerror = 1;
+ break;
case 'f':
haveopt_f = 1;
fflags = optarg;
@@ -1343,11 +1346,19 @@
if (!dounpriv) {
if ((gid != (gid_t)-1 || uid != (uid_t)-1) &&
- chown(path, uid, gid))
- warn("chown %u:%u %s", uid, gid, path);
+ chown(path, uid, gid)) {
+ if (doerror)
+ err(1,"chown %u:%u %s", uid, gid, path);
+ else
+ warn("chown %u:%u %s", uid, gid, path);
+ }
/* XXXBED: should we do the chmod in the dounpriv case? */
- if (chmod(path, mode))
- warn("chmod %o %s", mode, path);
+ if (chmod(path, mode)) {
+ if (doerror)
+ err(1,"chown %u:%u %s", uid, gid, path);
+ else
+ warn("chown %u:%u %s", uid, gid, path);
+ }
}
metadata_log(path, "dir", NULL, NULL, NULL, 0);
}
@@ -1441,15 +1452,15 @@
usage(void)
{
(void)fprintf(stderr,
-"usage: install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]\n"
+"usage: install [-bCcepSsUv] [-f flags] [-g group] [-m mode] [-o owner]\n"
" [-M log] [-D dest] [-h hash] [-T tags]\n"
" [-B suffix] [-l linkflags] [-N dbdir]\n"
" file1 file2\n"
-" install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]\n"
+" install [-bCcepSsUv] [-f flags] [-g group] [-m mode] [-o owner]\n"
" [-M log] [-D dest] [-h hash] [-T tags]\n"
" [-B suffix] [-l linkflags] [-N dbdir]\n"
" file1 ... fileN directory\n"
-" install -dU [-vU] [-g group] [-m mode] [-N dbdir] [-o owner]\n"
+" install -dU [-evU] [-g group] [-m mode] [-N dbdir] [-o owner]\n"
" [-M log] [-D dest] [-h hash] [-T tags]\n"
" directory ...\n");
exit(EX_USAGE);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Sep 17, 11:36 PM (7 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29741958
Default Alt Text
D14626.1789688172.diff (3 KB)
Attached To
Mode
D14626: add -e flag to install(1)
Attached
Detach File
Event Timeline
Log In to Comment