Skip to content

Commit

Permalink
#857: raise OSError instead of RuntimeError in case read() syscall fails
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Aug 5, 2016
1 parent 630b40d commit 05defa0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion psutil/_psutil_sunos.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ psutil_file_to_struct(char *path, void *fstruct, size_t size) {
return 0;
}
nbytes = read(fd, fstruct, size);
if (nbytes <= 0) {
if (nbytes == -1) {
close(fd);
PyErr_SetFromErrno(PyExc_OSError);
return 0;
Expand Down

0 comments on commit 05defa0

Please sign in to comment.