lkml.org 
[lkml]   [1999]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] Subtle race in dup2() and permissions on /proc/<pid>/fd/<n>
viro asks:

> dup2(foo, bar) closes bar, but completely ignores the results of
> close(). POSIX position on that?

The call
fd = dup2(fd1,fd2);
is equivalent to
close(fd2);
fd = fcntl(fd1, F_DUPFD, fd2);
except that
- if fd1==fd2 and both are valid, then dup2() returns this
without closing fd2
- if fd1 is invalid, dup2 returns -1 without closing fd2

So, yes, it looks like there is no provision for returning
close() errors here.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:1.123 / U:1.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site