FreeBSD Bugzilla – Attachment 5648 Details for
Bug 13365
Patch to mkfifo(1) for Unix 98 compliance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.11 KB, created by
howardjp
on 1999-08-25 03:50:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
howardjp
Created:
1999-08-25 03:50:01 UTC
Size:
3.11 KB
patch
obsolete
>diff -c /usr/src/usr.bin/mkfifo/mkfifo.1 /usr/local/src/mkfifo/mkfifo.1 >*** /usr/src/usr.bin/mkfifo/mkfifo.1 Sun Apr 27 08:45:45 1997 >--- /usr/local/src/mkfifo/mkfifo.1 Tue Aug 24 18:53:24 1999 >*************** >*** 43,48 **** >--- 43,49 ---- > .Nd make fifos > .Sh SYNOPSIS > .Nm >+ .Op Fl m Ar mode > .Ar fifo_name ... > .Sh DESCRIPTION > The >*************** >*** 54,59 **** >--- 55,77 ---- > The > .Nm > command requires write permission in the parent directory. >+ .Pp >+ The options are as follows >+ .Pp >+ .Bl -tag -width indent >+ .It Fl m >+ Set the file permission bits of the final created directory to >+ the specified mode. >+ The mode argument can be in any of the formats specified to the >+ .Xr chmod 1 >+ command. >+ If a symbolic mode is specified, the operation characters >+ .Dq + >+ and >+ .Dq - >+ are interpreted relative to an initial mode of >+ .Dq a=rwx . >+ .El > .Pp > The > .Nm >diff -c /usr/src/usr.bin/mkfifo/mkfifo.c /usr/local/src/mkfifo/mkfifo.c >*** /usr/src/usr.bin/mkfifo/mkfifo.c Thu Jul 24 07:02:55 1997 >--- /usr/local/src/mkfifo/mkfifo.c Tue Aug 24 19:11:30 1999 >*************** >*** 50,55 **** >--- 50,56 ---- > > #include <err.h> > #include <stdio.h> >+ #include <stdlib.h> > #include <string.h> > #include <unistd.h> > >*************** >*** 61,70 **** > char *argv[]; > { > extern int optind; >! int ch, exitval; > >! while ((ch = getopt(argc, argv, "")) != -1) > switch(ch) { > case '?': > default: > usage(); >--- 62,77 ---- > char *argv[]; > { > extern int optind; >! int ch, exitval, omode, success; >! mode_t *set = (mode_t *)NULL; >! char *mode; > >! mode = NULL; >! while ((ch = getopt(argc, argv, "m:")) != -1) > switch(ch) { >+ case 'm': >+ mode = optarg; >+ break; > case '?': > default: > usage(); >*************** >*** 74,84 **** > if (argv[0] == NULL) > usage(); > >! for (exitval = 0; *argv != NULL; ++argv) >! if (mkfifo(*argv, S_IRWXU | S_IRWXG | S_IRWXO) < 0) { > warn("%s", *argv); >! exitval = 1; > } > exit(exitval); > } > >--- 81,116 ---- > if (argv[0] == NULL) > usage(); > >! if (mode == NULL) { >! omode = S_IRWXU | S_IRWXG | S_IRWXO; >! } else { >! if ((set = setmode(mode)) == NULL) >! errx(1, "invalid file mode: %s", mode); >! omode = getmode(set, S_IRWXU | S_IRWXG | S_IRWXO); >! free(set); >! } >! >! for (exitval = 0; *argv != NULL; ++argv) { >! success = 1; >! if (mkfifo(*argv, omode) < 0) { > warn("%s", *argv); >! success = 0; > } >+ if (!success) >+ exitval = 1; >+ /* >+ * The mkdir() and umask() calls both honor only the low >+ * nine bits, so if you try to set a mode including the >+ * sticky, setuid, setgid bits you lose them. Don't do >+ * this unless the user has specifically requested a mode, >+ * as chmod will (obviously) ignore the umask. >+ */ >+ if (success && mode != NULL && chmod(*argv, omode) == -1) { >+ warn("%s", *argv); >+ exitval = 1; >+ } >+ } >+ > exit(exitval); > }
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 13365
: 5648