* winsup.api/ltp/dup03.c (cleanup): Fix longstanding off-by-one error when

setting array element to -1.
This commit is contained in:
Christopher Faylor
2005-12-11 22:31:00 +00:00
parent 4989ff286d
commit 4e8e54543e
2 changed files with 7 additions and 2 deletions

View File

@@ -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));
}