Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Sep 2014 21:20:37 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r271488 - head/sys/kern
Message-ID:  <201409122120.s8CLKbeU066806@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Fri Sep 12 21:20:36 2014
New Revision: 271488
URL: http://svnweb.freebsd.org/changeset/base/271488

Log:
  Tweak pipe_truncate() to more closely match pipe_chown() and pipe_chmod()
  by checking PIPE_NAMED and using invfo_truncate() for unnamed pipes.

Modified:
  head/sys/kern/sys_pipe.c

Modified: head/sys/kern/sys_pipe.c
==============================================================================
--- head/sys/kern/sys_pipe.c	Fri Sep 12 21:01:39 2014	(r271487)
+++ head/sys/kern/sys_pipe.c	Fri Sep 12 21:20:36 2014	(r271488)
@@ -1324,11 +1324,15 @@ pipe_truncate(fp, length, active_cred, t
 	struct ucred *active_cred;
 	struct thread *td;
 {
+	struct pipe *cpipe;
+	int error;
 
-	/* For named pipes call the vnode operation. */
-	if (fp->f_vnode != NULL)
-		return (vnops.fo_truncate(fp, length, active_cred, td));
-	return (EINVAL);
+	cpipe = fp->f_data;
+	if (cpipe->pipe_state & PIPE_NAMED)
+		error = vnops.fo_truncate(fp, length, active_cred, td);
+	else
+		error = invfo_truncate(fp, length, active_cred, td);
+	return (error);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409122120.s8CLKbeU066806>