From f04592ba230139d5132ebd8bb8610f6a98836882 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Thu, 9 Feb 2017 12:59:19 -0800 Subject: minui: Save errno before calling close(). Otherwise errno would be overwritten when calling close(2). Test: mmma bootable/recovery Change-Id: I661e46b1b040f550639a728aa2683e91621b4307 --- minui/graphics_adf.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'minui') diff --git a/minui/graphics_adf.cpp b/minui/graphics_adf.cpp index 17f30d1d4..9ab0b06bf 100644 --- a/minui/graphics_adf.cpp +++ b/minui/graphics_adf.cpp @@ -67,8 +67,9 @@ static int adf_surface_init(adf_pdata* pdata, drm_mode_modeinfo* mode, adf_surfa surf->base.data = static_cast(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; -- cgit v1.2.3