Changeset 765


Ignore:
Timestamp:
May 30, 2016, 7:12:12 PM (4 years ago)
Author:
djay
Message:

Fix issue when running service in asynch mode with missing parameters.

Location:
trunk/zoo-project/zoo-kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/service_internal_java.c

    r748 r765  
    8585  fprintf(stderr,"(%s)\n",oclasspath);
    8686#endif
    87 
     87#ifndef WIN32
    8888  int nb=1;
     89#endif
    8990  int nbc0=0;
    9091  maps* javaXXMap=getMaps(*main_conf,"javaxx");
     
    9899  }
    99100#ifdef WIN32
    100   nb=2+nbc0+nbc1;
    101   JavaVMOption options[nb];
     101  //#define nb (2+nbc0+nbc1)
     102  const int nb=2+nbc0+nbc1;
     103  JavaVMOption *options=(JavaVMOption*)malloc(nb*sizeof(JavaVMOption));
    102104#else
    103105  JavaVMOption options[nb+nbc0+nbc1+1];
     
    259261    free(options[start+i].optionString);
    260262  }
     263#ifdef WIN32
     264  free(options);
     265#endif
    261266  return res;
    262267}
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r752 r765  
    161161        str[i] = toReplaceBy;
    162162    }
     163}
     164
     165/**
     166 * Dump back the final file fbkp1 to fbkp
     167 *
     168 * @param m the conf maps containing the main.cfg settings
     169 * @param fbkp the string corresponding to the name of the file
     170 * @param fbkp1 the string corresponding to the name of the file
     171 */
     172int dumpBackFinalFile(maps* m,char* fbkp,char* fbkp1)
     173{
     174  FILE *f2 = fopen (fbkp1, "rb");
     175#ifndef RELY_ON_DB
     176  semid lid = getShmLockId (m, 1);
     177  if (lid < 0)
     178    return -1;
     179  lockShm (lid);
     180#endif
     181  FILE *f3 = fopen (fbkp, "wb+");
     182  free (fbkp);
     183  fseek (f2, 0, SEEK_END);
     184  long flen = ftell (f2);
     185  fseek (f2, 0, SEEK_SET);
     186  char *tmps1 = (char *) malloc ((flen + 1) * sizeof (char));
     187  fread (tmps1, flen, 1, f2);
     188#ifdef WIN32
     189  char *pchr=strrchr(tmps1,'>');
     190  flen=strlen(tmps1)-strlen(pchr)+1;
     191  tmps1[flen]=0;
     192#endif
     193  fwrite (tmps1, 1, flen, f3);
     194  fclose (f2);
     195  fclose (f3);
     196  return 1;
    163197}
    164198
     
    21372171            freeService (&s1);
    21382172            free (s1);
     2173            fclose (f0);
     2174            fclose (f1);
     2175            if(dumpBackFinalFile(m,fbkp,fbkp1)<0)
     2176              return -1;
     2177            unlink (fbkpid);
     2178            unhandleStatus (m);
    21392179            freeMaps (&m);
    21402180            free (m);
     
    21492189            fflush (stdout);
    21502190            fflush (stderr);
    2151             unhandleStatus (m);
    21522191            return -1;
    21532192          }
     
    21902229  signal (SIGABRT, donothing);
    21912230#endif
     2231 
    21922232  if (((int) getpid ()) != cpid || cgiSid != NULL)
    21932233    {
    21942234      fclose (stdout);
    21952235      fclose (stderr);
    2196       /**
    2197        * Dump back the final file fbkp1 to fbkp
    2198        */
     2236
    21992237      fclose (f0);
    22002238      fclose (f1);
    22012239
    2202       FILE *f2 = fopen (fbkp1, "rb");
    2203 #ifndef RELY_ON_DB
    2204       semid lid = getShmLockId (m, 1);
    2205       if (lid < 0)
    2206         return -1;
    2207       lockShm (lid);
    2208 #endif
    2209       FILE *f3 = fopen (fbkp, "wb+");
    2210       free (fbkp);
    2211       fseek (f2, 0, SEEK_END);
    2212       long flen = ftell (f2);
    2213       fseek (f2, 0, SEEK_SET);
    2214       char *tmps1 = (char *) malloc ((flen + 1) * sizeof (char));
    2215       fread (tmps1, flen, 1, f2);
    2216 #ifdef WIN32
    2217       char *pchr=strrchr(tmps1,'>');
    2218       flen=strlen(tmps1)-strlen(pchr)+1;
    2219       tmps1[flen]=0;
    2220 #endif
    2221       fwrite (tmps1, 1, flen, f3);
    2222       fclose (f2);
    2223       fclose (f3);
     2240      if(dumpBackFinalFile(m,fbkp,fbkp1)<0)
     2241        return -1;
     2242
    22242243      unlink (fbkpid);
    22252244      switch(eres){
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