From 188c2613b3744345e2ba3d4cfd0bcc47b12b74ae Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 18 Jan 2019 11:26:31 +0100 Subject: strip: Close debug file before unlinking it on error On some platforms, notably windows, you cannot unlink open files. Change-Id: Ifd73520005b3c233c112baf0b72fd8cf2f57c671 Reviewed-by: Christian Kandeler --- src/strip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/strip.c b/src/strip.c index aad1035b..0d570c29 100644 --- a/src/strip.c +++ b/src/strip.c @@ -2671,14 +2671,14 @@ cleanup_debug (void) { if (debug_fd >= 0) { + close (debug_fd); + debug_fd = -1; if (tmp_debug_fname != NULL) { unlink (tmp_debug_fname); free (tmp_debug_fname); tmp_debug_fname = NULL; } - close (debug_fd); - debug_fd = -1; } } -- cgit v1.2.3