summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_pipe.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2012-02-26 15:14:29 +0000
committerjilles <jilles@FreeBSD.org>2012-02-26 15:14:29 +0000
commit06d1ac3238bbb36d2fd71d3e7638421d54b4e928 (patch)
tree9a22ec43b49b3734fd66592c968ee72a6382ff26 /sys/kern/sys_pipe.c
parentb0cce2b35e7aed27791acc5e5a4e462830714425 (diff)
downloadFreeBSD-src-06d1ac3238bbb36d2fd71d3e7638421d54b4e928.zip
FreeBSD-src-06d1ac3238bbb36d2fd71d3e7638421d54b4e928.tar.gz
Fix fchmod() and fchown() on fifos.
The new fifo implementation in r232055 broke fchmod() and fchown() on fifos. Postfix needs this. Submitted by: gianni Reported by: dougb
Diffstat (limited to 'sys/kern/sys_pipe.c')
-rw-r--r--sys/kern/sys_pipe.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index 4f0217d..2902349 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -152,6 +152,8 @@ static fo_poll_t pipe_poll;
static fo_kqfilter_t pipe_kqfilter;
static fo_stat_t pipe_stat;
static fo_close_t pipe_close;
+static fo_chmod_t pipe_chmod;
+static fo_chown_t pipe_chown;
struct fileops pipeops = {
.fo_read = pipe_read,
@@ -162,8 +164,8 @@ struct fileops pipeops = {
.fo_kqfilter = pipe_kqfilter,
.fo_stat = pipe_stat,
.fo_close = pipe_close,
- .fo_chmod = invfo_chmod,
- .fo_chown = invfo_chown,
+ .fo_chmod = pipe_chmod,
+ .fo_chown = pipe_chown,
.fo_flags = DFLAG_PASSABLE
};
@@ -1548,6 +1550,43 @@ pipe_close(fp, td)
return (0);
}
+static int
+pipe_chmod(fp, mode, active_cred, td)
+ struct file *fp;
+ mode_t mode;
+ struct ucred *active_cred;
+ struct thread *td;
+{
+ struct pipe *cpipe;
+ int error;
+
+ cpipe = fp->f_data;
+ if (cpipe->pipe_state & PIPE_NAMED)
+ error = vn_chmod(fp, mode, active_cred, td);
+ else
+ error = invfo_chmod(fp, mode, active_cred, td);
+ return (error);
+}
+
+static int
+pipe_chown(fp, uid, gid, active_cred, td)
+ struct file *fp;
+ uid_t uid;
+ gid_t gid;
+ struct ucred *active_cred;
+ struct thread *td;
+{
+ struct pipe *cpipe;
+ int error;
+
+ cpipe = fp->f_data;
+ if (cpipe->pipe_state & PIPE_NAMED)
+ error = vn_chown(fp, uid, gid, active_cred, td);
+ else
+ error = invfo_chown(fp, uid, gid, active_cred, td);
+ return (error);
+}
+
static void
pipe_free_kmem(cpipe)
struct pipe *cpipe;
OpenPOWER on IntegriCloud