You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/08/20 20:51:59 UTC

svn commit: r806302 - in /commons/sandbox/runtime/trunk/src/main/native/os/unix: pmutex.c psema.c

Author: mturk
Date: Thu Aug 20 18:51:59 2009
New Revision: 806302

URL: http://svn.apache.org/viewvc?rev=806302&view=rev
Log:
Translate any slashes to underscore for posix semaphores

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c?rev=806302&r1=806301&r2=806302&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c Thu Aug 20 18:51:59 2009
@@ -73,6 +73,7 @@
     unsigned int ic = _mtx_counter;
     int rc = 0;
     acr_pmutex_t *m;
+    char *p;
 
     m = ACR_Calloc(_E, THROW_FMARK, sizeof(acr_pmutex_t));
     if (!m)
@@ -85,6 +86,10 @@
             m->name[0] = '/';
         strlcat(m->name, name, NAME_MAX - 2);
     }
+    for (p = &m->name[1]; *p; p++) {
+        if (*p == '/')
+            *p = '_';
+    }
     do {
         m->sem = sem_open(m->name, O_CREAT | O_EXCL, 0644, 1);
         if (m->sem == (sem_t *)SEM_FAILED) {
@@ -130,6 +135,7 @@
 {
     int rc = 0;
     acr_pmutex_t *m = NULL;
+    char *p;
 
     if (!name) {
         rc = ACR_EINVAL;
@@ -141,6 +147,10 @@
     if (*name != '/')
         m->name[0] = '/';
     strlcat(m->name, name, NAME_MAX - 2);
+    for (p = &m->name[1]; *p; p++) {
+        if (*p == '/')
+            *p = '_';
+    }
     m->sem = sem_open(m->name, O_RDWR);
     if (m->sem == (sem_t *)SEM_FAILED) {
         rc = ACR_GET_OS_ERROR();

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c?rev=806302&r1=806301&r2=806302&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c Thu Aug 20 18:51:59 2009
@@ -78,6 +78,7 @@
     unsigned int ic = _sem_counter;
     int rc = 0;
     acr_semaphore_t *s;
+    char *p;
 
     s = ACR_Calloc(_E, THROW_FMARK, sizeof(acr_semaphore_t));
     if (!s)
@@ -90,6 +91,10 @@
             s->name[0] = '/';
         strlcat(s->name, name, NAME_MAX - 2);
     }
+    for (p = &s->name[1]; *p; p++) {
+        if (*p == '/')
+            *p = '_';
+    }
     do {
         s->sem = sem_open(s->name, O_CREAT | O_EXCL, 0644, value);
         if (s->sem == (sem_t *)SEM_FAILED) {
@@ -135,6 +140,7 @@
 {
     int rc = 0;
     acr_semaphore_t *s = NULL;
+    char *p;
 
     if (!name) {
         rc = ACR_EINVAL;
@@ -146,6 +152,11 @@
     if (*name != '/')
         s->name[0] = '/';
     strlcat(s->name, name, NAME_MAX - 2);
+    for (p = &s->name[1]; *p; p++) {
+        if (*p == '/')
+            *p = '_';
+    }
+
     s->sem = sem_open(s->name, O_RDWR);
     if (s->sem == (sem_t *)SEM_FAILED) {
         rc = ACR_GET_OS_ERROR();