On Mon, Jan 23, 2017 at 2:25 AM, Christophe Milard
<christophe.mil...@linaro.org> wrote:
> Hence fixing CID 174663
> (Fixes https://bugs.linaro.org/show_bug.cgi?id=2827)
>
> Signed-off-by: Christophe Milard <christophe.mil...@linaro.org>

Reviewed-by: Bill Fischofer <bill.fischo...@linaro.org>

> ---
>
> since V1:
>   -print strerror(errno) and sets __odp_errno (Maxim)
>   -ref to bugzilla bug ID (Mike, Bill)
>
>  platform/linux-generic/_ishm.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c
> index f889834..5ca1067 100644
> --- a/platform/linux-generic/_ishm.c
> +++ b/platform/linux-generic/_ishm.c
> @@ -818,7 +818,14 @@ int _odp_ishm_reserve(const char *name, uint64_t size, 
> int fd,
>
>         /* If a file descriptor is provided, get the real size and map: */
>         if (fd >= 0) {
> -               fstat(fd, &statbuf);
> +               if (fstat(fd, &statbuf) < 0) {
> +                       close(fd);
> +                       odp_spinlock_unlock(&ishm_tbl->lock);
> +                       ODP_ERR("_ishm_reserve failed (fstat failed: %s).\n",
> +                               strerror(errno));
> +                       __odp_errno = errno;
> +                       return -1;
> +               }
>                 len = statbuf.st_size;
>                 /* note that the huge page flag is meningless here as huge
>                  * page is determined by the provided file descriptor: */
> --
> 2.7.4
>

Reply via email to