From: Uros Bizjak Date: Mon, 10 Oct 2011 22:24:21 +0000 (+0200) Subject: target-supports.exp (check_effective_target_fd_truncate): Close and unlink test file... X-Git-Tag: releases/gcc-4.7.0~3222 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=665f4c1f16ed24d3765e651d39dbb49cde3756e4;p=thirdparty%2Fgcc.git target-supports.exp (check_effective_target_fd_truncate): Close and unlink test file before exit. * lib/target-supports.exp (check_effective_target_fd_truncate): Close and unlink test file before exit. From-SVN: r179774 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1be870bbd3d3..314391b30454 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-10-11 Uros Bizjak + + * lib/target-supports.exp (check_effective_target_fd_truncate): + Close and unlink test file before exit. + 2011-10-10 Thomas Koenig PR fortran/50564 diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 550d53452445..a3b531162712 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3739,16 +3739,25 @@ proc check_effective_target_fd_truncate { } { int fd; const char t[] = "test writing more than ten characters"; char s[11]; - fd = fileno (f); + int status = 0; + fd = fileno (f); write (fd, t, sizeof (t) - 1); lseek (fd, 0, 0); if (ftruncate (fd, 10) != 0) - exit (1); + status = 1; close (fd); + fclose (f); + if (status) + { + unlink ("tst.tmp"); + exit (status); + } f = fopen ("tst.tmp", "rb"); if (fread (s, 1, sizeof (s), f) != 10 || strncmp (s, t, 10) != 0) - exit (1); - exit (0); + status = 1; + fclose (f); + unlink ("tst.tmp"); + exit (status); } }