From: Zdeněk Salvet Date: Wed, 15 Feb 2006 13:34:59 +0000 (+0000) Subject: Return timeout error instead of writing to unlocked event file X-Git-Tag: glite-lb-common_R_3_0_4~8 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=6f80831ba2fddbfa8644744d54cb36fec2533ee6;p=jra1mw.git Return timeout error instead of writing to unlocked event file if all lock attempts failed. Don't sleep after last lock attempt. --- diff --git a/org.glite.lb.common/src/log_msg.c b/org.glite.lb.common/src/log_msg.c index eaf5d2f..595ed19 100644 --- a/org.glite.lb.common/src/log_msg.c +++ b/org.glite.lb.common/src/log_msg.c @@ -143,7 +143,7 @@ int edg_wll_log_event_write( case EAGAIN: case EACCES: case EINTR: - sleep(fcntl_timeout); + if ((i+1) < fcntl_attempts) sleep(fcntl_timeout); break; default: edg_wll_SetError(ctx, errno, "fcntl()"); @@ -151,6 +151,10 @@ int edg_wll_log_event_write( } } else break; } + if (i == fcntl_attempts) { + edg_wll_SetError(ctx, ETIMEDOUT, "timed out trying to lock event file"); + goto cleanup; + } if ( fseek(outfile, 0, SEEK_END) == -1 ) { edg_wll_SetError(ctx, errno, "fseek()");