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
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-04-07 21:32:44 +0400
committerChristopher Faylor <me@cgf.cx>2012-04-07 21:32:44 +0400
commite5b7e4d1c796b0a07b3c9af7fbb8ad9d9db2f50c (patch)
tree6a3ae2bdc4a9a3d8a196b3d6fce2e1956a2ec56c /winsup/cygwin/dtable.cc
parent00ceaad13411f75e1a8d203e7506287e4170357f (diff)
* dtable.cc (cygwin_attach_handle_to_fd): Defend against NULL return from
build_fh_*. (dtable::init_std_file_from_handle): Ditto. * mmap.cc (mmap_record::alloc_fh): Ditto. * path.cc (path_conv::check): Ditto.
Diffstat (limited to 'winsup/cygwin/dtable.cc')
-rw-r--r--winsup/cygwin/dtable.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 15f4c0ce7..498e7fd8d 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -256,6 +256,8 @@ cygwin_attach_handle_to_fd (char *name, int fd, HANDLE handle, mode_t bin,
if (fd == -1)
fd = cygheap->fdtab.find_unused_handle ();
fhandler_base *fh = build_fh_name (name);
+ if (!fh)
+ return -1;
cygheap->fdtab[fd] = fh;
cygheap->fdtab[fd]->refcnt (1);
fh->init (handle, myaccess, bin ?: fh->pc_binmode ());
@@ -337,6 +339,9 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
else
fh = build_fh_name (name);
+ if (!fh)
+ return;
+
if (name[0])
{
bin = fh->pc_binmode ();