From 5e3af166d7f81d96adb225f6511d08e70bb2610d Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 17 May 2011 15:37:01 +0000 Subject: [PATCH] * miscfuncs.cc (thread_wrapper): Remove unused _cygtls record. * mmap.cc (is_mmapped_region): Avoid crash if no mmaps exist. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/miscfuncs.cc | 1 + winsup/cygwin/mmap.cc | 6 ++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 6622ac4ea..7f5cae4cb 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2011-05-17 Corinna Vinschen + + * miscfuncs.cc (thread_wrapper): Remove unused _cygtls record. + * mmap.cc (is_mmapped_region): Avoid crash if no mmaps exist. + 2011-05-16 Corinna Vinschen * globals.cc (__getlogin_username): Remove. diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc index a166ca1da..e6bb6c31f 100644 --- a/winsup/cygwin/miscfuncs.cc +++ b/winsup/cygwin/miscfuncs.cc @@ -412,6 +412,7 @@ thread_wrapper (VOID *arg) it's actually used by the thread function. So what we do here is to compute the stackbase of the application-provided stack, move _my_tls to the stackbase, and change the stack pointer accordingly. */ + _my_tls.remove (0); wrapper_arg.stackaddr = (PVOID) ((PBYTE) wrapper_arg.stackaddr + wrapper_arg.stacksize); _tlsbase = (char *) wrapper_arg.stackaddr; diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 9daa32fd7..53f9e4004 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -664,16 +664,18 @@ mmap_areas::del_list (mmap_list *ml) bool is_mmapped_region (caddr_t start_addr, caddr_t end_address) { - bool ret = false; - size_t len = end_address - start_addr; LIST_LOCK (); mmap_list *map_list = mmapped_areas.get_list_by_fd (-1, NULL); + if (!map_list) + return false; + mmap_record *rec; caddr_t u_addr; DWORD u_len; + bool ret = false; LIST_FOREACH (rec, &map_list->recs, mr_next) {