fixup for windows memory protection

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26732 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2008-06-29 19:21:15 +00:00
parent 703aff6ef5
commit a12a537b6f

View file

@ -116,14 +116,14 @@
*/ */
- (void) protect - (void) protect
{ {
#if defined(HAVE_MPROTECT) #if defined(__MINGW32__)
if (mprotect(buffer, size, PROT_READ|PROT_EXEC) == -1) DWORD old;
if (VirtualProtect(buffer, size, PAGE_EXECUTE, &old) == 0)
{ {
NSLog(@"Failed to protect memory as executable: %@", [NSError _last]); NSLog(@"Failed to protect memory as executable: %@", [NSError _last]);
} }
#elif defined(__MINGW32__) #elif defined(HAVE_MPROTECT)
DWORD old; if (mprotect(buffer, size, PROT_READ|PROT_EXEC) == -1)
if (VirtualProtect(buffer, size, PAGE_EXECUTE, &old) == 0)
{ {
NSLog(@"Failed to protect memory as executable: %@", [NSError _last]); NSLog(@"Failed to protect memory as executable: %@", [NSError _last]);
} }