diff options
author | Chris Michael <cpmichael@osg.samsung.com> | 2016-06-30 10:54:22 -0400 |
---|---|---|
committer | Chris Michael <cpmichael@osg.samsung.com> | 2016-06-30 10:54:22 -0400 |
commit | 0f965446a823f9d5c5e02424d04eecc35da547e9 (patch) | |
tree | e7877a119140dc6db0b495dbb704492df6a08fae /src/lib/elput | |
parent | 1fb3c3328604c56d20ea4a0e35925d4b9f94b185 (diff) |
elput: Check return of read function call
If we fail to read any bytes from the fd, then we should be returning
a failure here.
Fixes Coverity CID1357143
@fix
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
Diffstat (limited to 'src/lib/elput')
-rw-r--r-- | src/lib/elput/elput_input.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c index 1baf2f8dc8..bff5503692 100644 --- a/src/lib/elput/elput_input.c +++ b/src/lib/elput/elput_input.c | |||
@@ -40,8 +40,10 @@ _cb_open_restricted(const char *path, int flags, void *data) | |||
40 | avail = select(p[0] + 1, &rfds, &wfds, &exfds, t); | 40 | avail = select(p[0] + 1, &rfds, &wfds, &exfds, t); |
41 | if (avail > 0) | 41 | if (avail > 0) |
42 | { | 42 | { |
43 | read(p[0], &fd, sizeof(int)); | 43 | if (read(p[0], &fd, sizeof(int)) < 1) |
44 | ret = fd; | 44 | ret = -1; |
45 | else | ||
46 | ret = fd; | ||
45 | break; | 47 | break; |
46 | } | 48 | } |
47 | if (avail < 0) break; | 49 | if (avail < 0) break; |