From 0ea4d52e4396f6fdf44e6b0d5a21db17cad41ec7 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Wed, 29 Oct 2014 21:43:05 +0800 Subject: [PATCH] Close the file in fileio.exp test I see the following fail in fileio.exp on mingw32 host gdb, rename 1: ret = -1, errno = 13^M ^M Breakpoint 2, stop () at fileio.c:76^M 76 static void stop () {}^M (gdb) FAIL: gdb.base/fileio.exp: Rename a file the test fails to rename a file which is not expected. The previous test test_write doesn't close the file, so the rename fails as a result on Windows. This patch fixes it by closing file in test_write, and the fail goes away. rename 1: ret = 0, errno = 0 OK^M ^M Breakpoint 2, stop () at fileio.c:76^M 76 static void stop () {}^M (gdb) PASS: gdb.base/fileio.exp: Rename a file gdb/testsuite: 2014-10-29 Yao Qi * gdb.base/fileio.c (test_write): Close the file. --- gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.base/fileio.c | 1 + 2 files changed, 5 insertions(+) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 5d2d265393e..5b7e94c6ef8 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-10-29 Yao Qi + + * gdb.base/fileio.c (test_write): Close the file. + 2014-10-28 Pedro Alves PR gdb/12623 diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c index b8c26981728..29c32e00439 100644 --- a/gdb/testsuite/gdb.base/fileio.c +++ b/gdb/testsuite/gdb.base/fileio.c @@ -169,6 +169,7 @@ test_write () ret = write (fd, STRING, strlen (STRING)); printf ("write 3: ret = %d, errno = %d %s\n", ret, errno, strerrno (errno)); + close (fd); } else printf ("write 3: ret = %d, errno = %d\n", ret, errno); -- 2.30.2