Bug 1287739: Always set 'len' variable in storage test, r=mak
authorThomas Zimmermann <tdz@users.sourceforge.net>
Wed, 20 Jul 2016 16:12:31 +0200
changeset 345937 44888990d2df44e5f81ccd48fe9bee2416142c5a
parent 345936 b9f44fd406a34cafcc0c74cacfdbc50ddb096ddb
child 345938 ca723ddedfe522fbe0857083a63a5a2483cf0173
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1287739
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1287739: Always set 'len' variable in storage test, r=mak MozReview-Commit-ID: 8EpGeakICWY
storage/test/test_deadlock_detector.cpp
--- a/storage/test/test_deadlock_detector.cpp
+++ b/storage/test/test_deadlock_detector.cpp
@@ -155,17 +155,16 @@ public:
     void RunToCompletion(uint32_t aWaitMs)
     {
         PR_Close(mStdinfd);
 
         PRPollDesc pollfds[2];
         int32_t nfds;
         bool stdoutOpen = true, stderrOpen = true;
         char buf[4096];
-        int32_t len;
 
         PRIntervalTime now = PR_IntervalNow();
         PRIntervalTime deadline = now + PR_MillisecondsToInterval(aWaitMs);
 
         while ((stdoutOpen || stderrOpen) && now < deadline) {
             nfds = 0;
             if (stdoutOpen) {
                 pollfds[nfds].fd = mStdoutfd;
@@ -189,25 +188,23 @@ public:
                 return;
             }
 
             for (int32_t i = 0; i < nfds; ++i) {
                 if (!pollfds[i].out_flags)
                     continue;
 
                 bool isStdout = mStdoutfd == pollfds[i].fd;
-                
+                int32_t len = 0;
+
                 if (PR_POLL_READ & pollfds[i].out_flags) {
                     len = PR_Read(pollfds[i].fd, buf, sizeof(buf) - 1);
                     NS_ASSERTION(0 <= len, PR_ErrorToName(PR_GetError()));
                 }
-                else if (PR_POLL_HUP & pollfds[i].out_flags) {
-                    len = 0;
-                }
-                else {
+                else if (!(PR_POLL_HUP & pollfds[i].out_flags)) {
                     NS_ERROR(PR_ErrorToName(PR_GetError()));
                 }
 
                 if (0 < len) {
                     buf[len] = '\0';
                     if (isStdout)
                         mStdout += buf;
                     else