changeset 1059:a1d6e1980132

Fix fifo_tget to propagate any error returned by the posix call
author Sebastien Decugis <sdecugis@freediameter.net>
date Fri, 10 May 2013 09:50:09 +0800
parents 5d37c0db6cbf
children 757df62cadb6
files libfdproto/fifo.c
diffstat 1 files changed, 3 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libfdproto/fifo.c	Fri May 10 09:33:27 2013 +0800
+++ b/libfdproto/fifo.c	Fri May 10 09:50:09 2013 +0800
@@ -488,8 +488,8 @@
 /* The internal function for fd_fifo_timedget and fd_fifo_get */
 static int fifo_tget ( struct fifo * queue, void ** item, int istimed, const struct timespec *abstime)
 {
-	int timedout = 0;
 	int call_cb = 0;
+	int ret = 0;
 	
 	/* Check the parameters */
 	CHECK_PARAMS( CHECK_FIFO( queue ) && item && (abstime || !istimed) );
@@ -514,7 +514,6 @@
 		*item = mq_pop(queue);
 		call_cb = test_l_cb(queue);
 	} else {
-		int ret = 0;
 		/* We have to wait for a new item */
 		queue->thrs++ ;
 		pthread_cleanup_push( fifo_cleanup, queue);
@@ -528,12 +527,7 @@
 		if (ret == 0)
 			goto awaken;  /* test for spurious wake-ups */
 		
-		if (istimed && (ret == ETIMEDOUT)) {
-			timedout = 1;
-		} else {
-			/* Unexpected error condition (means we need to debug) */
-			ASSERT( ret == 0 /* never true */ );
-		}
+		/* otherwise (ETIMEDOUT / other error) just continue */
 	}
 	
 	/* Unlock */
@@ -544,7 +538,7 @@
 		(*queue->l_cb)(queue, &queue->data);
 	
 	/* Done */
-	return timedout ? ETIMEDOUT : 0;
+	return ret;
 }
 
 /* Get the next available item, block until there is one */
"Welcome to our mercurial repository"