glamor: Propagate glamor_fds_from_pixmap error in glamor_fd_from_pixmap

glamor_fds_from_pixmap returns 0 on error, but we were treating that as
success, continuing with uninitialized stride and fd values.

Also bail if the offset isn't 0, same as in dri3_fd_from_pixmap.

v2:
* Reduce to a simple one-liner fix (Emil Velikov)

Fixes: c8c276c956 "glamor: Implement PixmapFromBuffers and
                     BuffersFromPixmap"
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
Michel Dänzer 2018-05-23 11:18:02 +02:00 committed by Michel Dänzer
parent 3da999a039
commit 4d5950ce14

View File

@ -865,7 +865,7 @@ glamor_fd_from_pixmap(ScreenPtr screen,
&modifier);
/* Pixmaps with multi-planes/modifier are not supported in this interface */
if (ret > 1) {
if (ret != 1 || offsets[0] != 0) {
while (ret > 0)
close(fds[--ret]);
return -1;