Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-12-12 01:31:00 +0300
committerChristopher Faylor <me@cgf.cx>2005-12-12 01:31:00 +0300
commit4e8e54543e9e9dc20786e1f554d92186f812517e (patch)
treef7e235b5d484c304e14fc4075b6f4363e4d89d14
parent4989ff286d38fb49218afcc1f2a7907788e17477 (diff)
* winsup.api/ltp/dup03.c (cleanup): Fix longstanding off-by-one error when
setting array element to -1.
-rw-r--r--winsup/testsuite/ChangeLog5
-rw-r--r--winsup/testsuite/winsup.api/ltp/dup03.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/winsup/testsuite/ChangeLog b/winsup/testsuite/ChangeLog
index be6c82ce4..66944c0df 100644
--- a/winsup/testsuite/ChangeLog
+++ b/winsup/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-12-11 Christopher Faylor <cgf@timesys.com>
+
+ * winsup.api/ltp/dup03.c (cleanup): Fix longstanding off-by-one error
+ when setting array element to -1.
+
2005-06-11 Christopher Faylor <cgf@timesys.com>
* winsup.api/pthread/cancel2.c: Use explicit initializer for mutex.
diff --git a/winsup/testsuite/winsup.api/ltp/dup03.c b/winsup/testsuite/winsup.api/ltp/dup03.c
index bcc347aac..dc2efbb0a 100644
--- a/winsup/testsuite/winsup.api/ltp/dup03.c
+++ b/winsup/testsuite/winsup.api/ltp/dup03.c
@@ -271,8 +271,8 @@ cleanup()
/* close the open file we've been dup'ing */
if (Fd) {
- for (; Nfds >0 ; Nfds--) {
- if (close(Fd[Nfds-1]) == -1) {
+ while (Nfds-- >0) {
+ if (close(Fd[Nfds]) == -1) {
tst_resm(TWARN, "close(%s) Failed, errno=%d : %s",
Fname, errno, strerror(errno));
}