From: Aleš Křenek Date: Thu, 22 Mar 2007 10:27:18 +0000 (+0000) Subject: avoid code duplication in favour of goto X-Git-Tag: glite-lb-common_R_4_0_2_1~1 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=ee1b2503935af953013ce2a0b9271ce273642681;p=jra1mw.git avoid code duplication in favour of goto --- diff --git a/org.glite.lb.common/src/log_msg.c b/org.glite.lb.common/src/log_msg.c index 156f2f5..9d01165 100644 --- a/org.glite.lb.common/src/log_msg.c +++ b/org.glite.lb.common/src/log_msg.c @@ -123,6 +123,7 @@ int edg_wll_log_event_write( i, filelock_status=-1; struct stat statbuf; +try_again: if ( (outfile = fopen(event_file, "a")) == NULL ) { edg_wll_SetError(ctx, errno, "fopen()"); goto event_write_end; @@ -156,17 +157,7 @@ int edg_wll_log_event_write( if(errno == ENOENT) { /* not there anymore - reopen it */ fclose(outfile); - if ( (outfile = fopen(event_file, "a")) == NULL ) { - edg_wll_SetError(ctx, errno, "fopen()"); - goto event_write_end; - } - - if ( (filedesc = fileno(outfile)) == -1 ) { - edg_wll_SetError(ctx, errno, "fileno()"); - goto cleanup; - } - /* now it is time to try to lock it again */ - /* XXX - should we do that?: i = 0; */ + goto try_again; } else { /* could not stat the output file */ edg_wll_SetError(ctx, errno, "stat()");