From 1b9f41b9e54be50325130468fa6023ae070a6bcd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20=C5=A0kr=C3=A1bal?= Date: Mon, 11 Apr 2005 13:23:17 +0000 Subject: [PATCH] - do not reopen the file when could not lock it --- org.glite.lb.common/src/log_msg.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/org.glite.lb.common/src/log_msg.c b/org.glite.lb.common/src/log_msg.c index ea6260b..d495cbf 100644 --- a/org.glite.lb.common/src/log_msg.c +++ b/org.glite.lb.common/src/log_msg.c @@ -112,18 +112,18 @@ int edg_wll_log_event_write( i, filelock_status=-1; - for ( i = 0; i < fcntl_attempts; i++ ) { - if ( (outfile = fopen(event_file, "a")) == NULL ) { - edg_wll_SetError(ctx, errno, "fopen()"); - goto event_write_end; - } + 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()"); - fclose(outfile); - goto cleanup; - } + if ( (filedesc = fileno(outfile)) == -1 ) { + edg_wll_SetError(ctx, errno, "fileno()"); + fclose(outfile); + goto cleanup; + } + for ( i = 0; i < fcntl_attempts; i++ ) { filelock.l_type = F_WRLCK; filelock.l_whence = SEEK_SET; filelock.l_start = 0; @@ -140,7 +140,7 @@ int edg_wll_log_event_write( edg_wll_SetError(ctx, errno, "fcntl()"); goto cleanup; } - } + } else break; } if ( fseek(outfile, 0, SEEK_END) == -1 ) { -- 1.8.2.3