Ignore:
Timestamp:
May 31, 2019, 3:03:21 PM (5 years ago)
Author:
knut
Message:

Resolve certain string-related type conflicts, e.g., char* vs. const char* or char[N], that may cause errors in some build environments. Resolve a problem with the include order of fcgi_stdio.h (note: should verify that this harmonizes with resolution of same problem in trunk).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/prototype-v0/zoo-project/zoo-kernel/service_internal.c

    r899 r933  
    9999  struct zooLock* myLock=(struct zooLock*)malloc(sizeof(struct flock)+sizeof(FILE*)+sizeof(char*));
    100100  int len=6;
    101   char *myTemplate="%s.lock";
     101  static const char myTemplate[] = "%s.lock";
    102102  int res=-1;
    103103 retryLockFile:
     
    172172    }
    173173    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);
    177177      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         else
    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);
    182182#ifdef DEBUG
    183183      fprintf(stderr,"Unable to get the lock on %s due to the following error: %s\n",myLock->filename,tmp);
     
    317317  }
    318318  if(hasFile>0){
    319     semid lockid;
     319    semid lockid = NULL; // knut: add initialization
    320320    char* stat=getStatusId(conf,pid);
    321321    if(stat!=NULL){
     
    505505
    506506semid getShmLockId(maps* conf, int nsems){
    507   semid sem_id;
     507  semid sem_id; 
    508508  char key[MAX_PATH];
    509509  getKeyValue(conf, key, MAX_PATH);
    510510 
    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);
    512513  if(sem_id==NULL){
    513514#ifdef DEBUG
     
    564565
    565566char* getStatus(int pid){
     567  static char err[] = "-1";
     568
    566569  char *lpszBuf=(char*) malloc(SHMEMSIZE*sizeof(char));
    567570  int i=0;
     
    584587    fprintf(stderr,"ERROR on line %d\n",__LINE__);
    585588#endif
    586     return "-1";
     589    //return "-1";
     590    return err;
    587591  }
    588592  if((GetLastError() != ERROR_ALREADY_EXISTS)){
     
    593597    fIgnore = UnmapViewOfFile(lpvMem);
    594598    fIgnore = CloseHandle(hMapObject);
    595     return "-1";
     599    //return "-1";
     600    return err;
    596601  }
    597602  fInit=TRUE;
     
    608613    fprintf(stderr,"READING STRING S %s\n", getLastErrorMessage());
    609614#endif
    610     return "-1";
     615    //return "-1";
     616    return err;
    611617  }
    612618  lpszTmp = (LPWSTR) lpvMem;
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png