Switched to using the /tmp folder rather than the /var folder for
creating user semaphores under Linux.
This commit is contained in:
		| @@ -61,7 +61,7 @@ StaticLockFunction( | ||||
| // L2 | ||||
| //=======================================================================-- | ||||
| { | ||||
|    DbgTrace(2, "-StaticLockFunction- Start\n", 0); | ||||
|    DbgTrace(3, "-StaticLockFunction- Start\n", 0); | ||||
|  | ||||
|    // Verify that the lock number is within range | ||||
|    if (n < g_numStaticLocks | ||||
| @@ -81,10 +81,10 @@ StaticLockFunction( | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       DbgTrace(2, "-StaticLockFunction- n out of range\n", 0); | ||||
|       DbgTrace(0, "-StaticLockFunction- n out of range\n", 0); | ||||
|    } | ||||
|  | ||||
|    DbgTrace(2, "-StaticLockFunction- End\n", 0); | ||||
|    DbgTrace(3, "-StaticLockFunction- End\n", 0); | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -107,7 +107,7 @@ DynLockFunction( | ||||
| // L2 | ||||
| //=======================================================================-- | ||||
| { | ||||
|    DbgTrace(2, "-DynLockFunction- Start\n", 0); | ||||
|    DbgTrace(3, "-DynLockFunction- Start\n", 0); | ||||
|  | ||||
|    if (l) | ||||
|    { | ||||
| @@ -125,10 +125,10 @@ DynLockFunction( | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       DbgTrace(2, "-DynLockFunction- Invalid parameter\n", 0); | ||||
|       DbgTrace(0, "-DynLockFunction- Invalid parameter\n", 0); | ||||
|    } | ||||
|  | ||||
|    DbgTrace(2, "-DynLockFunction- End\n", 0); | ||||
|    DbgTrace(3, "-DynLockFunction- End\n", 0); | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -217,11 +217,11 @@ ThreadIdFunction(void) | ||||
| { | ||||
|    unsigned long  threadId; | ||||
|  | ||||
|    DbgTrace(2, "-ThreadIdFunction- Start\n", 0); | ||||
|    DbgTrace(3, "-ThreadIdFunction- Start\n", 0); | ||||
|  | ||||
|    threadId = (unsigned long) pthread_self(); | ||||
|  | ||||
|    DbgTrace(2, "-ThreadIdFunction- End, id = %0lX\n", threadId); | ||||
|    DbgTrace(3, "-ThreadIdFunction- End, id = %0lX\n", threadId); | ||||
|  | ||||
|    return threadId; | ||||
| } | ||||
|   | ||||
| @@ -76,17 +76,17 @@ typedef struct | ||||
| #define SEM_A 0200 | ||||
| #endif | ||||
|  | ||||
| #define  SVSEM_MODE  (SEM_R | SEM_A | SEM_R>>3 | SEM_R>>6) | ||||
| #define SVSEM_MODE  (SEM_R | SEM_A | SEM_R>>3 | SEM_R>>6) | ||||
|  | ||||
| #define  SEM_MAGIC   0x45678923 | ||||
| #define SEM_MAGIC   0x45678923 | ||||
|  | ||||
| #define  SEM_FAILED  ((Local_sem_t *)(-1)) /* avoid compiler warnings */ | ||||
| #define SEM_FAILED  ((Local_sem_t *)(-1)) /* avoid compiler warnings */ | ||||
|  | ||||
| #ifndef  SEMVMX | ||||
| #define  SEMVMX   32767    /* historical System V max value for sem */ | ||||
| #ifndef SEMVMX | ||||
| #define SEMVMX   32767    /* historical System V max value for sem */ | ||||
| #endif | ||||
|  | ||||
| #define  MAX_OPEN_SEM_TRIES   10 /* for waiting for initialization */ | ||||
| #define MAX_OPEN_SEM_TRIES   10 /* for waiting for initialization */ | ||||
|  | ||||
|  | ||||
| //===[ Function prototypes ]=============================================== | ||||
| @@ -392,7 +392,7 @@ CreateUserMutex( | ||||
|  | ||||
|    // We use Named Semaphores to provide this functionality. The semaphore names are | ||||
|    // linked to the user via its uid. | ||||
|    if (sprintf(g_userNamedSemName, "/var/lib/CASA/authtoken/semuser_%d", geteuid()) != -1) | ||||
|    if (sprintf(g_userNamedSemName, "/tmp/CASA/authtoken/client/semuser_%d", geteuid()) != -1) | ||||
|    { | ||||
|       // Create or open semaphore to be only used by the effective user | ||||
|       g_userNamedSem = Local_sem_open((const char*) g_userNamedSemName, O_RDWR | O_CREAT, 0600, 1); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user