Changeset 465 for trunk/zoo-project/zoo-kernel/zoo_service_loader.c
- Timestamp:
- Apr 23, 2014, 3:05:01 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r459 r465 239 239 map* r_inputs=NULL; 240 240 #ifndef WIN32 241 char* pntmp=getcwd(ntmp,1024);241 getcwd(ntmp,1024); 242 242 #else 243 243 _getcwd(ntmp,1024); … … 560 560 char ntmp[1024]; 561 561 #ifndef WIN32 562 char *pntmp=getcwd(ntmp,1024);562 getcwd(ntmp,1024); 563 563 #else 564 564 _getcwd(ntmp,1024); … … 760 760 while ((dp = readdir(dirp)) != NULL) 761 761 if(strstr(dp->d_name,".zcfg")!=0){ 762 int t; 762 763 memset(tmps1,0,1024); 763 764 snprintf(tmps1,1024,"%s/%s",conf_dir,dp->d_name); … … 769 770 fprintf(stderr,"#################\n%s\n#################\n",tmps1); 770 771 #endif 771 t=getServiceFromFile(tmps1,&s1); 772 t=readServiceFile(m,tmps1,&s1,dp->d_name); 773 if(t<0){ 774 dumpMaps(m); 775 map* tmp00=getMapFromMaps(m,"lenv","message"); 776 char tmp01[1024]; 777 sprintf(tmp01,_("Unable to parse the ZCFG file: %s (%s)"),dp->d_name,tmp00->value); 778 dup2(saved_stdout,fileno(stdout)); 779 errorException(m, tmp01,"InternalError",NULL); 780 freeMaps(&m); 781 free(m); 782 return 1; 783 } 784 772 785 #ifdef DEBUG 773 786 dumpService(s1); … … 828 841 829 842 r_inputs=getMap(request_inputs,"Identifier"); 830 char *tmps=strtok(r_inputs->value,","); 843 844 char *saveptr; 845 char *orig=zStrdup(r_inputs->value); 846 char *tmps=strtok_r(orig,",",&saveptr); 831 847 832 848 char buff[256]; … … 839 855 memset(buff1,0,1024); 840 856 #ifdef DEBUG 841 printf("\n#######%s\n########\n",buff 1);857 printf("\n#######%s\n########\n",buff); 842 858 #endif 843 859 while ((dp = readdir(dirp)) != NULL) … … 852 868 } 853 869 #ifdef DEBUG 854 printf("#################\n%s\n#################\n",buff1); 855 #endif 856 t=getServiceFromFile(buff1,&s1); 870 printf("#################\n(%s) %s\n#################\n",r_inputs->value,buff1); 871 #endif 872 char *tmp0=zStrdup(dp->d_name); 873 tmp0[strlen(tmp0)-5]=0; 874 t=readServiceFile(m,buff1,&s1,tmp0); 875 free(tmp0); 876 if(t<0){ 877 map* tmp00=getMapFromMaps(m,"lenv","message"); 878 char tmp01[1024]; 879 if(tmp00!=NULL) 880 sprintf(tmp01,_("Unable to parse the ZCFG file: %s (%s)"),dp->d_name,tmp00->value); 881 else 882 sprintf(tmp01,_("Unable to parse the ZCFG file: %s."),dp->d_name); 883 dup2(saved_stdout,fileno(stdout)); 884 errorException(m, tmp01,"InternalError",NULL); 885 freeMaps(&m); 886 free(m); 887 return 1; 888 } 857 889 #ifdef DEBUG 858 890 dumpService(s1); … … 861 893 freeService(&s1); 862 894 free(s1); 895 s1=NULL; 863 896 scount++; 864 897 } 865 898 rewinddir(dirp); 866 tmps=strtok (NULL,",");899 tmps=strtok_r(NULL,",",&saveptr); 867 900 } 868 901 closedir(dirp); 869 902 fflush(stdout); 870 903 dup2(saved_stdout,fileno(stdout)); 904 free(orig); 871 905 printDocument(m,doc,getpid()); 872 906 freeMaps(&m); … … 917 951 int saved_stdout = dup(fileno(stdout)); 918 952 dup2(fileno(stderr),fileno(stdout)); 919 t= getServiceFromFile(tmps1,&s1);953 t=readServiceFile(m,tmps1,&s1,r_inputs->value); 920 954 fflush(stdout); 921 955 dup2(saved_stdout,fileno(stdout)); … … 2181 2215 addToMap(_tmpMaps->content,"sid",tmpBuff); 2182 2216 addToMap(_tmpMaps->content,"status","0"); 2217 addToMap(_tmpMaps->content,"cwd",ntmp); 2183 2218 addToMap(_tmpMaps->content,"message",_("No message provided")); 2184 addToMap(_tmpMaps->content,"cwd",ntmp);2185 2219 map* ltmp=getMap(request_inputs,"soap"); 2186 2220 if(ltmp!=NULL) … … 2248 2282 freeMaps(&_tmpMaps); 2249 2283 free(_tmpMaps); 2250 2284 2251 2285 #ifdef DEBUG 2252 2286 dumpMap(request_inputs); … … 2265 2299 } 2266 2300 #endif 2267 int hrstd=-1;2268 2301 char *fbkp,*fbkp1; 2269 2302 FILE *f0,*f1;
Note: See TracChangeset
for help on using the changeset viewer.