OSDN Git Service

* cygheap.cc (_csbrk): Don't request zero bytes from VirtualAlloc,
authordavek <davek>
Tue, 11 Dec 2007 15:16:19 +0000 (15:16 +0000)
committerdavek <davek>
Tue, 11 Dec 2007 15:16:19 +0000 (15:16 +0000)
as windows treats that as an invalid parameter and returns an error.

winsup/cygwin/ChangeLog
winsup/cygwin/cygheap.cc

index f97f3ff..e358f70 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-11  Dave Korn  <dave.korn@artimi.com>
+
+       * cygheap.cc (_csbrk):  Don't request zero bytes from VirtualAlloc,
+       as windows treats that as an invalid parameter and returns an error.
+
 2007-12-11  Corinna Vinschen  <corinna@vinschen.de>
 
        * localtime.cc (tzset): Call tzsetwall only if it hasn't been
index b9f24ee..23e193b 100644 (file)
@@ -129,7 +129,7 @@ _csbrk (int sbs)
        newbase = _cygheap_end;
 
       DWORD adjsbs = allocsize ((char *) cygheap_max - newbase);
-      if (!VirtualAlloc (newbase, adjsbs, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE))
+      if (adjsbs && !VirtualAlloc (newbase, adjsbs, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE))
        {
          MEMORY_BASIC_INFORMATION m;
          if (!VirtualQuery (newbase, &m, sizeof m))