Changeset 554 for trunk/zoo-project/zoo-kernel/service_internal.c
- Timestamp:
- Feb 5, 2015, 7:17:31 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal.c
r550 r554 124 124 #define SHMEMSIZE 4096 125 125 126 char* getKeyValue(maps* conf){ 127 if(conf==NULL) 128 return "700666"; 126 size_t getKeyValue(maps* conf, char* key, size_t length){ 127 128 if(conf==NULL) { 129 strncpy(key, "700666", length); 130 return strlen(key); 131 } 132 129 133 map *tmpMap=getMapFromMaps(conf,"lenv","lid"); 130 134 if(tmpMap==NULL) 131 132 char* key="-1"; 135 tmpMap=getMapFromMaps(conf,"lenv","usid"); 136 133 137 if(tmpMap!=NULL){ 134 key=(char*)malloc((strlen(tmpMap->value)+9)*sizeof(char)); 135 sprintf(key,"zoo_sem_%s",tmpMap->value);136 }137 return key; 138 }139 140 138 snprintf(key, length, "zoo_sem_%s", tmpMap->value); 139 } 140 else { 141 strncpy(key, "-1", length); 142 } 143 return strlen(key); 144 } 141 145 semid getShmLockId(maps* conf, int nsems){ 142 146 semid sem_id; 143 char* key=getKeyValue(conf); 147 char key[MAX_PATH]; 148 getKeyValue(conf, key, MAX_PATH); 144 149 145 150 sem_id = CreateSemaphore( NULL, nsems, nsems+1, key); 146 151 if(sem_id==NULL){ 147 if(strncmp(key,"-1",2)!=0) 148 free(key); 152 149 153 #ifdef DEBUG 150 154 fprintf(stderr,"Semaphore failed to create ! %s\n",GetLastError()); … … 155 159 fprintf(stderr,"%s Accessed !\n",key); 156 160 #endif 157 if(strncmp(key,"-1",2)!=0) 158 free(key); 161 159 162 return sem_id; 160 163 } … … 3335 3338 mimeType=strdup("none"); 3336 3339 else 3337 mimeType=strdup((char*)hInternet->ihandle[index].mimeType);3340 mimeType=strdup(hInternet->ihandle[index].mimeType); 3338 3341 3339 3342 map* tmpMap=getMapOrFill(&content->content,vname,"");
Note: See TracChangeset
for help on using the changeset viewer.