diff options
author | Nicholas Bishop <[email protected]> | 2016-09-08 15:55:02 -0400 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2016-09-27 13:37:21 +0100 |
commit | 2d05ba2ca0af336ceae3167432d7df9df3366b74 (patch) | |
tree | 1dc90142959190c9bb0ce477b41e0f9788954e04 | |
parent | a5993022275c20061ac025d9adc26c5f9d02afee (diff) |
gbm: return appropriate error when queryImage() fails
Change gbm_dri_bo_get_fd to check the return value of queryImage and
return -1 (an invalid file descriptor) if an error occurs.
Update the comment for gbm_bo_get_fd to return -1, since (apart from the
above) we've already return -1 on error.
Cc: [email protected]
Signed-off-by: Nicholas Bishop <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]> (v1)
[Emil Velikov: Split from larger patch, polish coding style, cc stable]
Signed-off-by: Emil Velikov <[email protected]>
-rw-r--r-- | src/gbm/backends/dri/gbm_dri.c | 3 | ||||
-rw-r--r-- | src/gbm/main/gbm.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 0ab67dad210..f863616ab08 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -591,7 +591,8 @@ gbm_dri_bo_get_fd(struct gbm_bo *_bo) if (bo->image == NULL) return -1; - dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_FD, &fd); + if (!dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_FD, &fd)) + return -1; return fd; } diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c index 5a8e8b7b9f0..b9fb70d1293 100644 --- a/src/gbm/main/gbm.c +++ b/src/gbm/main/gbm.c @@ -204,7 +204,8 @@ gbm_bo_get_handle(struct gbm_bo *bo) * descriptor. * \param bo The buffer object - * \return Returns a file descriptor referring to the underlying buffer + * \return Returns a file descriptor referring to the underlying buffer or -1 + * if an error occurs. */ GBM_EXPORT int gbm_bo_get_fd(struct gbm_bo *bo) |