[PATCH] dup3 fix
Ulrich Drepper authored

Al Viro notice one cornercase that the new dup3() code.  The dup2()
function, as a special case, handles dup-ing to the same file
descriptor.  In this case the current dup3() code does nothing at
all.  I.e., it ingnores the flags parameter.  This shouldn't happen,
the close-on-exec flag should be set if requested.

In case the O_CLOEXEC bit in the flags parameter is not set the
dup3() function should behave in this respect identical to dup2().
This means dup3(fd, fd, 0) should not actively reset the c-o-e
flag.

The patch below implements this minor change.

[AV: credits to Artur Grabowski for bringing that up as potential subtle point
in dup2() behaviour]
Signed-off-by: default avatarUlrich Drepper <drepper@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
3c333937
Name Last commit Last update
..
9p 9p: fix O_APPEND in legacy mode
adfs SL*B: drop kmem cache argument from constructor
affs SL*B: drop kmem cache argument from constructor
afs [PATCH] sanitize ->permission() prototype
autofs mount options: fix autofs
autofs4 autofs4: remove unused ioctls
befs SL*B: drop kmem cache argument from constructor
bfs SL*B: drop kmem cache argument from constructor
cifs [PATCH] sanitize ->permission() prototype
coda [PATCH] sanitize __user_walk_fd() et.al.
configfs configfs: Allow ->make_item() and ->make_group() to return detailed errors.
cramfs fs: Remove unnecessary inclusions of asm/semaphore.h
debugfs debugfs: Implement debugfs_remove_recursive()
devpts devpts: factor out PTY index allocation
dlm locks: add special return value for asynchronous locks
ecryptfs [PATCH] kill nameidata passing to permission(), rename to inode_permission()
efs SL*B: drop kmem cache argument from constructor
exportfs fs: replace remaining __FUNCTION__ occurrences
ext2 [PATCH] sanitize ->permission() prototype
ext3 [PATCH] sanitize ->permission() prototype
ext4 [PATCH] sanitize ->permission() prototype
fat [patch 3/4] fat: dont call notify_change
freevxfs fs/freevxfs/: proper externs
fuse [PATCH] fix MAY_CHDIR/MAY_ACCESS/LOOKUP_ACCESS mess
gfs2 [PATCH] don't pass nameidata to gfs2_lookupi()
hfs
hfsplus
hostfs
hpfs
hppfs
hugetlbfs
isofs
jbd
jbd2
jffs2
jfs
lockd
minix
msdos
ncpfs
nfs
nfs_common
nfsd
nls
ntfs
ocfs2
omfs
openpromfs
partitions
proc
qnx4
ramfs
reiserfs
romfs
smbfs
sysfs
sysv
ubifs
udf
ufs
vfat
xfs
Kconfig
Kconfig.binfmt
Makefile
aio.c
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf.c
binfmt_elf_fdpic.c
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
binfmt_som.c
bio-integrity.c
bio.c
block_dev.c
buffer.c
char_dev.c
compat.c
compat_binfmt_elf.c
compat_ioctl.c
dcache.c
dcookies.c
direct-io.c
dnotify.c
dquot.c
drop_caches.c
eventfd.c
eventpoll.c
exec.c
fcntl.c
fifo.c
file.c
file_table.c
filesystems.c
fs-writeback.c
generic_acl.c
inode.c
inotify.c
inotify_user.c
internal.h
ioctl.c
ioprio.c
libfs.c
locks.c
mbcache.c
mpage.c
namei.c
namespace.c
nfsctl.c
no-block.c
open.c
pipe.c
pnode.c
pnode.h
posix_acl.c
quota.c
quota_v1.c
quota_v2.c
read_write.c
read_write.h
readdir.c
select.c
seq_file.c
signalfd.c
splice.c
stack.c
stat.c
super.c
sync.c
timerfd.c
utimes.c
xattr.c
xattr_acl.c