summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dtable.h
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-04-01 22:28:39 +0000
committerChristopher Faylor <me@cgf.cx>2012-04-01 22:28:39 +0000
commit881beea81de7a0877c64c01ba74de5e8a8d9dfd5 (patch)
treec09074c640b7e836e09e2333d55675b4f4b6baf6 /winsup/cygwin/dtable.h
parentc4ee9311c2c8cd01cadaa411900d284ba0fd2bdb (diff)
downloadcygnal-881beea81de7a0877c64c01ba74de5e8a8d9dfd5.tar.gz
cygnal-881beea81de7a0877c64c01ba74de5e8a8d9dfd5.tar.bz2
cygnal-881beea81de7a0877c64c01ba74de5e8a8d9dfd5.zip
* dtable.cc (dtable::fixup_close): Define new function.
(dtable::fixup_after_exec): Use fixup_close() and detect when it was not possible to open an inherited file handle. (dtable::fixup_after_fork): Defensively close any file handles which were not, for some reason, inheritable. * dtable.h: Make #pragma once. (dtable::fixup_close): Declare new function. * fhandler_console.cc (fhandler_console::set_unit): Set I/O handles to NULL when this function fails.
Diffstat (limited to 'winsup/cygwin/dtable.h')
-rw-r--r--winsup/cygwin/dtable.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/winsup/cygwin/dtable.h b/winsup/cygwin/dtable.h
index d0065f421..288b4767f 100644
--- a/winsup/cygwin/dtable.h
+++ b/winsup/cygwin/dtable.h
@@ -9,6 +9,8 @@ This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
+#pragma once
+
/* Initial and increment values for cygwin's fd table */
#define NOFILE_INCR 32
/* Maximum size we allow expanding to. */
@@ -54,6 +56,8 @@ public:
fhandler_base *dup_worker (fhandler_base *oldfh, int flags);
int extend (int howmuch);
void fixup_after_fork (HANDLE);
+ void fixup_close (size_t, fhandler_base *);
+
inline int not_open (int fd)
{
lock ();