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>
This commit is contained in:
Chris Michael 2016-06-30 10:54:22 -04:00
parent 1fb3c33286
commit 0f965446a8
1 changed files with 4 additions and 2 deletions

View File

@ -40,8 +40,10 @@ _cb_open_restricted(const char *path, int flags, void *data)
avail = select(p[0] + 1, &rfds, &wfds, &exfds, t);
if (avail > 0)
{
read(p[0], &fd, sizeof(int));
ret = fd;
if (read(p[0], &fd, sizeof(int)) < 1)
ret = -1;
else
ret = fd;
break;
}
if (avail < 0) break;