FreeBSD Bugzilla – Attachment 26557 Details for
Bug 45333
[patch] New option -r for chown(8) and chgrp(1)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.84 KB, created by
Oliver Fromme
on 2002-11-16 11:00:04 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Oliver Fromme
Created:
2002-11-16 11:00:04 UTC
Size:
3.84 KB
patch
obsolete
>--- src/usr.sbin/chown/chgrp.1.orig Wed Aug 15 11:09:46 2001 >+++ src/usr.sbin/chown/chgrp.1 Sat Nov 16 10:23:46 2002 >@@ -50,6 +50,14 @@ > .Oc > .Ar group > .Ar >+.Nm >+.Op Fl fhv >+.Oo >+.Fl R >+.Op Fl H | Fl L | Fl P >+.Oc >+.Fl r Ar rfile >+.Ar > .Sh DESCRIPTION > The > .Nm >@@ -84,6 +92,9 @@ > .It Fl h > If the file is a symbolic link, the group ID of the link itself is changed > rather than the file that is pointed to. >+.It Fl r Ar rfile >+Sets the group ID to the group of the file >+.Ar rfile . > .It Fl v > Cause > .Nm >--- src/usr.sbin/chown/chown.8.orig Sun Jul 14 16:42:43 2002 >+++ src/usr.sbin/chown/chown.8 Sat Nov 16 10:27:45 2002 >@@ -55,6 +55,15 @@ > .Oc > .No : Ns Ar group > .Ar >+.Nm >+.Op Fl fhv >+.Oo >+.Fl R >+.Op Fl H | Fl L | Fl P >+.Oc >+.Fl r Ar rfile >+.Op Fl g >+.Ar > .Sh DESCRIPTION > The > .Nm >@@ -85,9 +94,24 @@ > .It Fl f > Don't report any failure to change file owner or group, nor modify > the exit status to reflect such failures. >+.It Fl g >+See the >+.Fl r >+option. > .It Fl h > If the file is a symbolic link, change the user ID and/or the > group ID of the link itself. >+.It Fl r Ar rfile >+Changes the user ID to the owner of the file >+.Ar rfile . >+If the >+.Fl g >+option is also specified, change both user ID and group ID >+to the owner and group of the file >+.Ar rfile . >+Use the >+.Xr chgrp 1 >+utility to change the group ID only. > .It Fl v > Cause > .Nm >--- src/usr.sbin/chown/chown.c.orig Wed Jul 17 18:22:24 2002 >+++ src/usr.sbin/chown/chown.c Sat Nov 16 11:13:45 2002 >@@ -75,16 +75,17 @@ > { > FTS *ftsp; > FTSENT *p; >- int Hflag, Lflag, Rflag, fflag, hflag, vflag; >+ int Hflag, Lflag, Rflag, fflag, gflag, hflag, rflag, vflag; > int ch, fts_options, rval; > char *cp; >+ char *rname; > > cp = strrchr(argv[0], '/'); > cp = (cp != NULL) ? cp + 1 : argv[0]; > ischown = (strcmp(cp, "chown") == 0); > >- Hflag = Lflag = Rflag = fflag = hflag = vflag = 0; >- while ((ch = getopt(argc, argv, "HLPRfhv")) != -1) >+ Hflag = Lflag = Rflag = fflag = gflag = hflag = rflag = vflag = 0; >+ while ((ch = getopt(argc, argv, "HLPRfghr:v")) != -1) > switch (ch) { > case 'H': > Hflag = 1; >@@ -103,9 +104,16 @@ > case 'f': > fflag = 1; > break; >+ case 'g': >+ gflag = 1; >+ break; > case 'h': > hflag = 1; > break; >+ case 'r': >+ rflag = 1; >+ rname = optarg; >+ break; > case 'v': > vflag = 1; > break; >@@ -116,7 +124,9 @@ > argv += optind; > argc -= optind; > >- if (argc < 2) >+ if (argc < (rflag ? 1 : 2)) >+ usage(); >+ if (gflag && !ischown) > usage(); > > if (Rflag) { >@@ -135,7 +145,17 @@ > > uid = (uid_t)-1; > gid = (gid_t)-1; >- if (ischown) { >+ if (rflag) { >+ struct stat sb; >+ >+ if (stat(rname, &sb) == -1) >+ err(EXIT_FAILURE, "%s", rname); >+ if (ischown) >+ uid = sb.st_uid; >+ if (gflag || !ischown) >+ gid = sb.st_gid; >+ } >+ else if (ischown) { > if ((cp = strchr(*argv, ':')) != NULL) { > *cp++ = '\0'; > a_gid(cp); >@@ -147,11 +167,11 @@ > a_gid(cp); > } > #endif >- a_uid(*argv); >+ a_uid(*argv++); > } else >- a_gid(*argv); >+ a_gid(*argv++); > >- if ((ftsp = fts_open(++argv, fts_options, 0)) == NULL) >+ if ((ftsp = fts_open(argv, fts_options, 0)) == NULL) > err(1, NULL); > > for (rval = 0; (p = fts_read(ftsp)) != NULL;) { >@@ -273,12 +293,16 @@ > { > > if (ischown) >- (void)fprintf(stderr, "%s\n%s\n", >+ (void)fprintf(stderr, "%s\n%s\n%s\n", > "usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group]" > " file ...", >- " chown [-fhv] [-R [-H | -L | -P]] :group file ..."); >+ " chown [-fhv] [-R [-H | -L | -P]] :group file ...", >+ " chown [-fhv] [-R [-H | -L | -P]] -r rfile [-g]" >+ " file ..."); > else >- (void)fprintf(stderr, "%s\n", >- "usage: chgrp [-fhv] [-R [-H | -L | -P]] group file ..."); >+ (void)fprintf(stderr, "%s\n%s\n", >+ "usage: chgrp [-fhv] [-R [-H | -L | -P]] group file ...", >+ "usage: chgrp [-fhv] [-R [-H | -L | -P]] -r rfile" >+ " file ..."); > exit(1); > } >--- chown.current.diff ends here ---
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 45333
:
26556
| 26557