From: Subrata <sub...@us...> - 2008-03-14 19:49:24
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/dup2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25396/ltp/testcases/kernel/syscalls/dup2 Modified Files: dup203.c Log Message: Fixes the hardcoded file descriptor in the second testcase within dup203.c . Instead of assuming file descriptor 10 is closed, the fix explicitly opens and closes a file descriptor before using it as the second argument of dup2(). We saw issues on some environments where dup2(10,10) was being called, which this fixes, by, Henry Wei <hy...@mv...> Index: dup203.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/dup2/dup203.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dup203.c 30 Oct 2007 10:46:58 -0000 1.5 --- dup203.c 14 Mar 2008 19:49:20 -0000 1.6 *************** *** 173,182 **** } ! TEST(dup2(fd0, 10)); if ((fd1 = TEST_RETURN) == -1) { tst_resm(TFAIL, "call failed unexpectedly"); } else if (STD_FUNCTIONAL_TEST) { ! if (fd1 != 10) { tst_resm(TFAIL, "bad dup2 descriptor %d", fd1); break; --- 173,192 ---- } ! if ((fd2 = creat(filename1, 0666)) == -1) { ! tst_brkm(TBROK, cleanup, "Cannot create second file"); ! /*NOTREACHED*/ ! } ! ! if (close(fd2) == -1) { ! tst_brkm(TBROK, cleanup, "close(2) fd_closed failed"); ! /*NOTREACHED*/ ! } ! ! TEST(dup2(fd0, fd2)); if ((fd1 = TEST_RETURN) == -1) { tst_resm(TFAIL, "call failed unexpectedly"); } else if (STD_FUNCTIONAL_TEST) { ! if (fd1 != fd2) { tst_resm(TFAIL, "bad dup2 descriptor %d", fd1); break; *************** *** 202,205 **** --- 212,216 ---- unlink(filename0); + unlink(filename1); tst_resm(TINFO, "Exit block 2"); } |