Merge "minui: Save errno before calling close()." am: df464dbe79 am: 8075089ca1 am: 30c164411f
am: 0b4641724b
Change-Id: I494ad8c5749290645f9850410789247e35d3bd41
diff --git a/minui/graphics_adf.cpp b/minui/graphics_adf.cpp
index 17f30d1..9ab0b06 100644
--- a/minui/graphics_adf.cpp
+++ b/minui/graphics_adf.cpp
@@ -67,8 +67,9 @@
surf->base.data = static_cast<uint8_t*>(mmap(nullptr, surf->pitch * surf->base.height, PROT_WRITE,
MAP_SHARED, surf->fd, surf->offset));
if (surf->base.data == MAP_FAILED) {
+ int saved_errno = errno;
close(surf->fd);
- return -errno;
+ return -saved_errno;
}
return 0;