Fix socket descritpor leak in http client post
[com/gs-lite.git] / src / ftacmp / translate_fta.cc
index 97aa38a..4ee0bb4 100644 (file)
@@ -397,24 +397,26 @@ int main(int argc, char **argv){
                while(fgets(tmpstr,TMPSTRLEN,osp_in)){
                        o_lineno++;
                        int nflds = split_string(tmpstr,',',flds,MAXFLDS);
-                       if(nflds == 7){
+                       if(tmpstr[0]!='\n' && tmpstr[0]!='\r' && tmpstr[0]!='\0' && tmpstr[0]!='#'){
+                               if(nflds == 7){
 //             make operator type lowercase
-                               char *tmpc;
-                               for(tmpc=flds[1];*tmpc!='\0';++tmpc)
-                                       *tmpc = tolower(*tmpc);
-
-                               ospec_str *tmp_ospec = new ospec_str();
-                               tmp_ospec->query = flds[0];
-                               tmp_ospec->operator_type = flds[1];
-                               tmp_ospec->operator_param = flds[2];
-                               tmp_ospec->output_directory = flds[3];
-                               tmp_ospec->bucketwidth = atoi(flds[4]);
-                               tmp_ospec->partitioning_flds = flds[5];
-                               tmp_ospec->n_partitions = atoi(flds[6]);
-                               qname_to_ospec.insert(pair<string,int>(tmp_ospec->query,output_specs.size()));
-                               output_specs.push_back(tmp_ospec);
-                       }else{
-                               fprintf(stderr,"Warning, line %d corrupted in output_spec.cfg, has %d fields.\n",o_lineno,nflds);
+                                       char *tmpc;
+                                       for(tmpc=flds[1];*tmpc!='\0';++tmpc)
+                                               *tmpc = tolower(*tmpc);
+       
+                                       ospec_str *tmp_ospec = new ospec_str();
+                                       tmp_ospec->query = flds[0];
+                                       tmp_ospec->operator_type = flds[1];
+                                       tmp_ospec->operator_param = flds[2];
+                                       tmp_ospec->output_directory = flds[3];
+                                       tmp_ospec->bucketwidth = atoi(flds[4]);
+                                       tmp_ospec->partitioning_flds = flds[5];
+                                       tmp_ospec->n_partitions = atoi(flds[6]);
+                                       qname_to_ospec.insert(pair<string,int>(tmp_ospec->query,output_specs.size()));
+                                       output_specs.push_back(tmp_ospec);
+                               }else{
+                                       fprintf(stderr,"Warning, line %d corrupted in output_spec.cfg, has %d fields.\n",o_lineno,nflds);
+                               }
                        }
                }
                fclose(osp_in);
@@ -1353,6 +1355,7 @@ fprintf(stderr,"Parsing file %s\n",qpathname.c_str());
        }
        if(dangling_ospecs!=""){
                fprintf(stderr,"WARNING, the following entries in output_spec.cfg don't have a matching query: %s\n",dangling_ospecs.c_str());
+               exit(1);
        }
 
        string dangling_par = "";
@@ -2317,7 +2320,6 @@ for(i=0;i<hfta_list.size();++i){          // query also has an HFTA component
 //                     if(hfta_namespace == "")
 //                             warning_str += "\tnamespace not found.\n";
 
-// STOPPED HERE
 //     There is a get_tbl_keys method implemented for qp_nodes,
 //     integrate it into steam_query, then call it to find keys,
 //     and annotate feidls with their key-ness.