summaryrefslogtreecommitdiffstats
path: root/tests/newfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/newfile.c')
-rw-r--r--tests/newfile.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/newfile.c b/tests/newfile.c
index 5eabdcb7..a2793171 100644
--- a/tests/newfile.c
+++ b/tests/newfile.c
@@ -63,8 +63,6 @@ main (int argc, char *argv[] __attribute__ ((unused)))
printf ("cannot create temporary file: %m\n");
exit (1);
}
- /* Remove the file when we exit. */
- unlink (fname);
elf_version (EV_CURRENT);
elf = elf_begin (fd, ELF_C_WRITE, NULL);
@@ -166,5 +164,10 @@ main (int argc, char *argv[] __attribute__ ((unused)))
(void) elf_end (elf);
}
+ close (fd);
+
+ /* Remove the file when we exit. */
+ unlink (fname);
+
return result;
}