Author: mturk
Date: Tue Aug 18 17:51:42 2009
New Revision: 805512
URL: http://svn.apache.org/viewvc?rev=805512&view=rev
Log:
Allow attach to delete the filename
Modified:
commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c?rev=805512&r1=805511&r2=805512&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c Tue Aug 18
17:51:42 2009
@@ -255,6 +255,7 @@
HANDLE hmap;
wchar_t reskey[128];
void *base;
+ int pagefile = 0;
if (!filename) {
ACR_SET_OS_ERROR(ACR_EINVAL);
@@ -263,8 +264,10 @@
shm = ACR_Calloc(_E, THROW_FMARK, sizeof(acr_shm_t));
if (!shm)
return -1;
- if (_wcsnicmp(filename, L"shared::", 8) == 0)
+ if (_wcsnicmp(filename, L"shared::", 8) == 0) {
filename += 8;
+ pagefile = 1;
+ }
res_name_from_filenamew(ACR_DT_SHM, reskey, filename);
hmap = OpenFileMappingW(FILE_MAP_READ | FILE_MAP_WRITE, FALSE, reskey);
if (!hmap) {
@@ -283,7 +286,8 @@
shm->hmap = hmap;
shm->length = shm->memblk->length;
shm->usrmem = (char*)base + sizeof(memblock_t);
- shm->filename = NULL;
+ if (!pagefile)
+ shm->filename = ACR_StrdupW(_E, THROW_FMARK, filename);
finally:
if (rc) {