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);
 }
 
 /*
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to