diff --git a/src/spaceDelete.c b/src/spaceDelete.c index 43fd717..8d3319a 100644 --- a/src/spaceDelete.c +++ b/src/spaceDelete.c @@ -39,9 +39,24 @@ int msgSpaceDelete(msgSpaceId externId){ printf("ok\n"); if (shm_unlink(nzgId)<0){ - perror("shm_unlink"); - return -1; + NZG_ERROR("shm_unlink",nzgId); + goto ERROR; }; + if (msgSpaceListLock()<0){ + NZG_ERROR("msgSpaceListLock",""); + goto ERROR; + } + + if (msgSpaceListRem(nzgId) < 0){ + NZG_ERROR("msgSpaceListRem",nzgId); + goto ERROR; + } + if (msgSpaceListUnlock()< 0){ + NZG_ERROR("msgSpaceListUnlock",""); + goto ERROR; + } return 0; +ERROR: + return -1; } diff --git a/test/put_get_mono.c b/test/put_get_mono.c index fb1aa94..92afea8 100644 --- a/test/put_get_mono.c +++ b/test/put_get_mono.c @@ -40,5 +40,6 @@ int main(void) { montext=msgGet(mSPAC,0,0); printf("get-ok\n"); printf("### test Reception %d ###\n",(int)*montext); + msgSpaceDelete(testId); return 0; }