From owner-svn-src-all@FreeBSD.ORG Sun Feb 26 15:14:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2DC4106564A; Sun, 26 Feb 2012 15:14:29 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A21478FC08; Sun, 26 Feb 2012 15:14:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1QFETUC070812; Sun, 26 Feb 2012 15:14:29 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1QFET0v070810; Sun, 26 Feb 2012 15:14:29 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201202261514.q1QFET0v070810@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 26 Feb 2012 15:14:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232183 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Feb 2012 15:14:29 -0000 Author: jilles Date: Sun Feb 26 15:14:29 2012 New Revision: 232183 URL: http://svn.freebsd.org/changeset/base/232183 Log: 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 Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Sun Feb 26 14:27:34 2012 (r232182) +++ head/sys/kern/sys_pipe.c Sun Feb 26 15:14:29 2012 (r232183) @@ -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;