lkml.org 
[lkml]   [2008]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] unify sys_pipe implementation
On 5/5/08, DM <dm.n9107@gmail.com> wrote:
> On Sat, May 3, 2008 at 8:01 PM, Ulrich Drepper <drepper@redhat.com> wrote:
> [...]
>
> > /*
> > + * sys_pipe() is the normal C calling standard for creating
> > + * a pipe. It's not the way Unix traditionally does this, though.
> > + */
> > +asmlinkage long sys_pipe(int __user *fildes)
> > +{
> > + int fd[2];
> > + int error;
> > +
> > + error = do_pipe(fd);
> > + if (!error) {
> > + if (copy_to_user(fildes, fd, sizeof(fd)))
> > + error = -EFAULT;
> > + }
> > + return error;
> > +}
> > +
>
> [...]
>
> I realize this code is old, but wouldn't file descriptors leak if
> copy_to_user fails?

Yes, it does -- I just tested this.

--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html


\
 
 \ /
  Last update: 2008-05-05 11:19    [W:0.041 / U:2.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site