From 6f80831ba2fddbfa8644744d54cb36fec2533ee6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20Salvet?= Date: Wed, 15 Feb 2006 13:34:59 +0000 Subject: [PATCH] Return timeout error instead of writing to unlocked event file if all lock attempts failed. Don't sleep after last lock attempt. --- org.glite.lb.common/src/log_msg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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()"); -- 1.8.2.3