- Timestamp:
- May 31, 2019, 3:03:21 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/prototype-v0/zoo-project/zoo-kernel/service_internal.c
r899 r933 99 99 struct zooLock* myLock=(struct zooLock*)malloc(sizeof(struct flock)+sizeof(FILE*)+sizeof(char*)); 100 100 int len=6; 101 char *myTemplate="%s.lock";101 static const char myTemplate[] = "%s.lock"; 102 102 int res=-1; 103 103 retryLockFile: … … 172 172 } 173 173 if(res<0){ 174 char *tmp;175 if (errno==EBADF)176 tmp="Either: the filedes argument is invalid; you requested a read lock but the filedes is not open for read access; or, you requested a write lock but the filedes is not open for write access.";174 char tmp[512]; 175 if (errno == EBADF) 176 strncpy(tmp, "Either: the filedes argument is invalid; you requested a read lock but the filedes is not open for read access; or, you requested a write lock but the filedes is not open for write access.", 512); 177 177 else 178 if(errno==EINVAL)179 tmp="Either the lockp argument doesn’t specify valid lock information, or the file associated with filedes doesn’t support locks.";180 181 tmp="The system has run out of file lock resources; there are already too many file locks in place.";178 if (errno == EINVAL) 179 strncpy(tmp, "Either the lockp argument doesn’t specify valid lock information, or the file associated with filedes doesn’t support locks.", 512); 180 else 181 strncpy(tmp, "The system has run out of file lock resources; there are already too many file locks in place.", 512); 182 182 #ifdef DEBUG 183 183 fprintf(stderr,"Unable to get the lock on %s due to the following error: %s\n",myLock->filename,tmp); … … 317 317 } 318 318 if(hasFile>0){ 319 semid lockid ;319 semid lockid = NULL; // knut: add initialization 320 320 char* stat=getStatusId(conf,pid); 321 321 if(stat!=NULL){ … … 505 505 506 506 semid getShmLockId(maps* conf, int nsems){ 507 semid sem_id; 507 semid sem_id; 508 508 char key[MAX_PATH]; 509 509 getKeyValue(conf, key, MAX_PATH); 510 510 511 sem_id = CreateSemaphore( NULL, nsems, nsems+1, key); 511 //sem_id = CreateSemaphore( NULL, nsems, nsems+1, key); knut: CreateSemaphore may alias to wide-character version CreateSemaphoreW 512 sem_id = CreateSemaphoreA( NULL, nsems, nsems+1, key); 512 513 if(sem_id==NULL){ 513 514 #ifdef DEBUG … … 564 565 565 566 char* getStatus(int pid){ 567 static char err[] = "-1"; 568 566 569 char *lpszBuf=(char*) malloc(SHMEMSIZE*sizeof(char)); 567 570 int i=0; … … 584 587 fprintf(stderr,"ERROR on line %d\n",__LINE__); 585 588 #endif 586 return "-1"; 589 //return "-1"; 590 return err; 587 591 } 588 592 if((GetLastError() != ERROR_ALREADY_EXISTS)){ … … 593 597 fIgnore = UnmapViewOfFile(lpvMem); 594 598 fIgnore = CloseHandle(hMapObject); 595 return "-1"; 599 //return "-1"; 600 return err; 596 601 } 597 602 fInit=TRUE; … … 608 613 fprintf(stderr,"READING STRING S %s\n", getLastErrorMessage()); 609 614 #endif 610 return "-1"; 615 //return "-1"; 616 return err; 611 617 } 612 618 lpszTmp = (LPWSTR) lpvMem;
Note: See TracChangeset
for help on using the changeset viewer.