Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-02-01 21:38:07 +0400
committerChristopher Faylor <me@cgf.cx>2012-02-01 21:38:07 +0400
commit29b7448d580d8f91551c528560512e22c371955a (patch)
treeb05eb42e8b00accd64e723954caae99c7312bbc4 /winsup
parent8fa8b3a3891165dc4c8eb8f05923a3352b20aec3 (diff)
* fcntl.cc (fcntl64): Add introductory debug statement. Call dup3 directory
via dtable method to avoid over-incrementing refcnt.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/fcntl.cc10
2 files changed, 12 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index a774fee02..935a2bf29 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2012-02-01 Christopher Faylor <me.cygwin2012@cgf.cx>
+ * fcntl.cc (fcntl64): Add introductory debug statement. Call dup3
+ directory via dtable method to avoid over-incrementing refcnt.
+
+2012-02-01 Christopher Faylor <me.cygwin2012@cgf.cx>
+
* dtable.cc (dtable::dup_worker): Add comment explaining why refcnt
isn't incremented here.
(dtable::dup3): Simplify slightly. Add comment.
diff --git a/winsup/cygwin/fcntl.cc b/winsup/cygwin/fcntl.cc
index 9b27f17fd..d89baa7d2 100644
--- a/winsup/cygwin/fcntl.cc
+++ b/winsup/cygwin/fcntl.cc
@@ -1,7 +1,7 @@
/* fcntl.cc: fcntl syscall
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2008,
- 2009, 2010, 2011 Red Hat, Inc.
+ 2009, 2010, 2011, 2012 Red Hat, Inc.
This file is part of Cygwin.
@@ -28,6 +28,7 @@ fcntl64 (int fd, int cmd, ...)
pthread_testcancel ();
+ debug_printf ("fcntl(%d, %d, ...)", fd, cmd);
myfault efault;
if (efault.faulted (EFAULT))
return -1;
@@ -45,8 +46,10 @@ fcntl64 (int fd, int cmd, ...)
case F_DUPFD:
case F_DUPFD_CLOEXEC:
if ((int) arg >= 0 && (int) arg < OPEN_MAX_MAX)
- res = dup3 (fd, cygheap_fdnew (((int) arg) - 1),
- cmd == F_DUPFD_CLOEXEC ? O_CLOEXEC : 0);
+ {
+ int flags = cmd == F_DUPFD_CLOEXEC ? O_CLOEXEC : 0;
+ res = cygheap->fdtab.dup3 (fd, cygheap_fdnew (((int) arg) - 1), flags);
+ }
else
{
set_errno (EINVAL);
@@ -107,3 +110,4 @@ _fcntl (int fd, int cmd, ...)
}
return res;
}
+