Bugzilla bug #50386: fixed PR_Sleep so that it won't return uninitialized
authorwtc%netscape.com
Sat, 26 Aug 2000 00:55:20 +0000
changeset 1548 5a5acb769137f2111c10195bdd670697474c706a
parent 1547 b0897d3ee67e5735be855a10b0aab08f949a4a45
child 1549 f1608a5190e058854599c0405bdd44b8952665f8
push idunknown
push userunknown
push dateunknown
bugs50386
Bugzilla bug #50386: fixed PR_Sleep so that it won't return uninitialized variable. Thanks to Fred Batty <fredb@iplanet.com> for reporting the bug.
pr/src/pthreads/ptthread.c
--- a/pr/src/pthreads/ptthread.c
+++ b/pr/src/pthreads/ptthread.c
@@ -744,24 +744,23 @@ PR_IMPLEMENT(PRStatus) PR_Yield()
     static PRBool warning = PR_TRUE;
     if (warning) warning = _PR_Obsolete(
         "PR_Yield()", "PR_Sleep(PR_INTERVAL_NO_WAIT)");
     return PR_Sleep(PR_INTERVAL_NO_WAIT);
 }
 
 PR_IMPLEMENT(PRStatus) PR_Sleep(PRIntervalTime ticks)
 {
-    PRStatus rv;
+    PRStatus rv = PR_SUCCESS;
 
     if (!_pr_initialized) _PR_ImplicitInitialization();
 
     if (PR_INTERVAL_NO_WAIT == ticks)
     {
         _PT_PTHREAD_YIELD();
-        rv = PR_SUCCESS;
     }
     else
     {
         PRCondVar *cv;
         PRIntervalTime timein;
 
         timein = PR_IntervalNow();
         cv = PR_NewCondVar(_pr_sleeplock);