소스 검색

fix breakage in pthread_cond_wait due to typo

due to accidental use of = instead of ==, the error code was always
set to zero in the signaled wake case for non-shared cv waits.
suppressing ETIMEDOUT (the only possible wait error) is harmless and
actually permitted in this case, but suppressing mutex errors could
give the caller false information about the state of the mutex.

commit 8741ffe625363a553e8f509dc3ca7b071bdbab47 introduced this
regression and commit d9da1fb8c592469431c764732d09f7756340190e
preserved it when reorganizing the code.
Rich Felker 10 년 전
부모
커밋
e487c203db
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/thread/pthread_cond_timedwait.c

+ 1 - 1
src/thread/pthread_cond_timedwait.c

@@ -163,7 +163,7 @@ relock:
 		a_dec(&m->_m_waiters);
 
 	/* Since a signal was consumed, cancellation is not permitted. */
-	if (e = ECANCELED) e = 0;
+	if (e == ECANCELED) e = 0;
 
 done:
 	__pthread_setcancelstate(cs, 0);