Tweak pipe_truncate() to more closely match pipe_chown() and pipe_chmod()

by checking PIPE_NAMED and using invfo_truncate() for unnamed pipes.
This commit is contained in:
John Baldwin 2014-09-12 21:20:36 +00:00
parent 59101c5d95
commit cd550b9b52
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=271488

View File

@ -1324,11 +1324,15 @@ pipe_truncate(fp, length, active_cred, td)
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);
}
/*