Browse Source

check PR_Read for failure

georges 25 years ago
parent
commit
b8fc114a81
1 changed files with 5 additions and 1 deletions
  1. 5 1
      panda/src/ipc/ipc_nspr_traits.h

+ 5 - 1
panda/src/ipc/ipc_nspr_traits.h

@@ -234,7 +234,11 @@ public:
            int numRead;
            char* temp = new char[numBytes];
            if (_fhandle != (PRFileDesc *)NULL){
- 	     numRead = PR_Read(_fhandle, temp, numBytes);
+             numRead = PR_Read(_fhandle, temp, numBytes);
+             if(numRead<=0) {
+                cerr << "PR_Read() in libnspr failed!\n";
+                return 0;
+             }
              block.assign(temp, numRead);
              delete temp;
              return numRead;