Don't store SRC_INSTANCE in store_flesh() if some error already occured.
authorZdeněk Salvet <salvet@ics.muni.cz>
Wed, 9 Nov 2005 09:59:52 +0000 (09:59 +0000)
committerZdeněk Salvet <salvet@ics.muni.cz>
Wed, 9 Nov 2005 09:59:52 +0000 (09:59 +0000)
Avoids useless work and, more importantly, preserves description of
the previous error in context.

org.glite.lb.server/src/store.c.T

index 6ce17fb..3754cb2 100644 (file)
@@ -333,11 +333,13 @@ static int store_flesh(edg_wll_Context ctx,edg_wll_Event *e,char *jobid,int no)
        for (i=0; i<sizeof(f)/sizeof(f[0]); i++) free(f[i].val);
 
 /* XXX: hardcoded, no other suitable place to store it */
-       trio_asprintf(&stmt,"insert into short_fields(jobid,event,name,value) "
-               "values ('%|Ss',%d,'SRC_INSTANCE','%|Ss')",
-               jobid,no,e->any.src_instance);
-       if (edg_wll_ExecStmt(ctx,stmt,NULL) < 0) err = edg_wll_Error(ctx,NULL,NULL);
-       free(stmt);
+       if (!err) {
+               trio_asprintf(&stmt,"insert into short_fields(jobid,event,name,value) "
+                       "values ('%|Ss',%d,'SRC_INSTANCE','%|Ss')",
+                       jobid,no,e->any.src_instance);
+               if (edg_wll_ExecStmt(ctx,stmt,NULL) < 0) err = edg_wll_Error(ctx,NULL,NULL);
+               free(stmt);
+       }
 
        return err;
 }