On Fri, Nov 16, 2012 at 7:02 PM, Mark Salter <msal...@redhat.com> wrote: > On Thu, 2012-11-15 at 17:13 -0500, Rich Felker wrote: >> On Tue, Nov 13, 2012 at 11:31:25AM +0000, Markos Chandras wrote: >> > From: Markos Chandras <markos.chand...@imgtec.com> >> > >> > Signed-off-by: Markos Chandras <markos.chand...@imgtec.com> >> > --- >> > libc/sysdeps/linux/common/dup2.c | 8 +++++++- >> > 1 files changed, 7 insertions(+), 1 deletions(-) >> > >> > diff --git a/libc/sysdeps/linux/common/dup2.c >> > b/libc/sysdeps/linux/common/dup2.c >> > index 006f06b..e58105d 100644 >> > --- a/libc/sysdeps/linux/common/dup2.c >> > +++ b/libc/sysdeps/linux/common/dup2.c >> > @@ -10,6 +10,12 @@ >> > #include <sys/syscall.h> >> > #include <unistd.h> >> > >> > - >> > +#if defined(__NR_dup3) && ! defined(__NR_dup2) >> > +int dup2(int old, int newfd) >> > +{ >> > + return dup3(old, newfd, 0); >> > +} >> > +#else >> > _syscall2(int, dup2, int, oldfd, int, newfd) >> > +#endif >> > libc_hidden_def(dup2) >> >> This is not valid. dup3 explicitly fails if old==newfd, but dup2 is >> required to work in this case. However you can't just return success >> in that case, because old might not be valid. You need to perform >> fcntl or something to determine if the fd is valid, and return an >> error if it's not. > > Markos, this was previously discussed here: > > http://lists.uclibc.org/pipermail/uclibc/2012-April/046737.html > >
Hi Mark, Excellent, this is pretty much what I had in mind. Sorry, I haven't seen this patchset before. I'll see if I can pick up some fixes for the v2 of my patches. -- Regards, Markos _______________________________________________ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc