Ignore:
Timestamp:
Mar 2, 2012, 12:55:11 PM (8 years ago)
Author:
djay
Message:

Use dynamically allocated memory for Java CLASSPATH

File:
1 edited

Legend:

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

    r354 r355  
    3232  getcwd(ntmp,1024);
    3333  map* tmp=getMap(request,"metapath");
    34   char classpath[2048];
    35   char oclasspath[2068];
     34  char *classpath;
     35  char *oclasspath;
    3636  int res=SERVICE_FAILED;
    3737  char *cclasspath=getenv("CLASSPATH");
    3838  if(tmp!=NULL){
    39     if(cclasspath!=NULL)
     39    if(cclasspath!=NULL){
     40      classpath=(char*) malloc((strlen(ntmp)+strlen(tmp->value)+strlen(cclasspath)+4)*sizeof(char));
     41      oclasspath=(char*) malloc((strlen(ntmp)+strlen(tmp->value)+strlen(cclasspath)+22)*sizeof(char));
    4042      sprintf(classpath,"%s/%s/:%s",ntmp,tmp->value,cclasspath);
    41     else
     43    }
     44    else{
     45      classpath=(char*) malloc((strlen(ntmp)+strlen(tmp->value)+3)*sizeof(char));
     46      oclasspath=(char*) malloc((strlen(ntmp)+strlen(tmp->value)+21)*sizeof(char));
    4247      sprintf(classpath,"%s/%s/",ntmp,tmp->value);
    43     sprintf(oclasspath,"-Djava.class.path=%s",classpath);
    44   }
    45   else{
    46     if(cclasspath!=NULL)
    47       sprintf(classpath,"%s:%s",ntmp,cclasspath);
    48     else
    49       sprintf(classpath,"%s",ntmp);
     48    }
    5049    sprintf(oclasspath,"-Djava.class.path=%s",classpath);
    5150  }
     
    5453  fprintf(stderr,"(%s)\n",oclasspath);
    5554#endif
    56   setenv("CLASSPATH",classpath,1);
    5755
    5856  JavaVMOption options[1];
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