diff options
author | Christopher Faylor <me@cgf.cx> | 2005-12-11 22:31:00 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2005-12-11 22:31:00 +0000 |
commit | 4e8e54543e9e9dc20786e1f554d92186f812517e (patch) | |
tree | f7e235b5d484c304e14fc4075b6f4363e4d89d14 | |
parent | 4989ff286d38fb49218afcc1f2a7907788e17477 (diff) | |
download | cygnal-4e8e54543e9e9dc20786e1f554d92186f812517e.tar.gz cygnal-4e8e54543e9e9dc20786e1f554d92186f812517e.tar.bz2 cygnal-4e8e54543e9e9dc20786e1f554d92186f812517e.zip |
* winsup.api/ltp/dup03.c (cleanup): Fix longstanding off-by-one error when
setting array element to -1.
-rw-r--r-- | winsup/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/testsuite/winsup.api/ltp/dup03.c | 4 |
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)); } |