]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
target-supports.exp (check_effective_target_fd_truncate): Close and unlink test file...
authorUros Bizjak <ubizjak@gmail.com>
Mon, 10 Oct 2011 22:24:21 +0000 (00:24 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Mon, 10 Oct 2011 22:24:21 +0000 (00:24 +0200)
* lib/target-supports.exp (check_effective_target_fd_truncate):
Close and unlink test file before exit.

From-SVN: r179774

gcc/testsuite/ChangeLog
gcc/testsuite/lib/target-supports.exp

index 1be870bbd3d38308d49b664784613362cf8185f4..314391b304545597a65fb7cd1093ce1b31f5ed91 100644 (file)
@@ -1,3 +1,8 @@
+2011-10-11  Uros Bizjak  <ubizjak@gmail.com>
+
+       * lib/target-supports.exp (check_effective_target_fd_truncate):
+       Close and unlink test file before exit.
+
 2011-10-10  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/50564
index 550d53452445693cea4980e3908dbb5f80926d31..a3b531162712cf6acce08984357d900d6aa18312 100644 (file)
@@ -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);
        }
     }