<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Issues related to this mail: <a href="https://github.com/linux-test-project/ltp/issues/570" _src="https://github.com/linux-test-project/ltp/issues/570">https://github.com/linux-test-project/ltp/issues/570</a> </div><div><br></div><div>According to the bactrace in the issue description, we could easily find out that the problem is due to the codes in dup201.c  line 80 and 142. </div><div>As metan-cuw commented, the loop at line 142 is of no use and probablely is a leftover.  So we could safely remove these codes. </div><div><br></div><div>This patch does :</div><div>        1).  remove the leftover, and of course, the issue 570 will be eventually go over.</div><div>        2).  removed unused global variables.</div><div><br></div><div>The patch goes as:</div><div><br></div><div><div>diff --git a/testcases/kernel/syscalls/dup2/dup201.c b/testcases/kernel/syscalls/dup2/dup201.c</div><div>index 4507ac1..762ad86 100644</div><div>--- a/testcases/kernel/syscalls/dup2/dup201.c</div><div>+++ b/testcases/kernel/syscalls/dup2/dup201.c</div><div>@@ -75,9 +75,6 @@ int maxfd;</div><div> int goodfd = 5;</div><div> int badfd = -1;</div><div> int mystdout = 0;</div><div>-int fd, fd1;</div><div>-int mypid;</div><div>-char fname[20];</div><div><br></div><div> struct test_case_t {</div><div>        int *ofd;</div><div>@@ -86,22 +83,19 @@ struct test_case_t {</div><div>        void (*setupfunc) ();</div><div> } TC[] = {</div><div>        /* First fd argument is less than 0 - EBADF */</div><div>-       {</div><div>-       &badfd, &goodfd, EBADF, NULL},</div><div>-           /* First fd argument is getdtablesize() - EBADF */</div><div>-       {</div><div>-       &maxfd, &goodfd, EBADF, NULL},</div><div>-           /* Second fd argument is less than 0 - EBADF */</div><div>-       {</div><div>-       &mystdout, &badfd, EBADF, NULL},</div><div>-           /* Second fd argument is getdtablesize() - EBADF */</div><div>-       {</div><div>-&mystdout, &maxfd, EBADF, NULL},};</div><div>+       {&badfd, &goodfd, EBADF, NULL},</div><div>+       /* First fd argument is getdtablesize() - EBADF */</div><div>+       {&maxfd, &goodfd, EBADF, NULL},</div><div>+       /* Second fd argument is less than 0 - EBADF */</div><div>+       {&mystdout, &badfd, EBADF, NULL},</div><div>+       /* Second fd argument is getdtablesize() - EBADF */</div><div>+       {&mystdout, &maxfd, EBADF, NULL},</div><div>+};</div><div><br></div><div> int main(int ac, char **av)</div><div> {</div><div>        int lc;</div><div>-       int i, j;</div><div>+       int i;</div><div><br></div><div>        tst_parse_opts(ac, av, NULL, NULL);</div><div><br></div><div>@@ -137,12 +131,6 @@ int main(int ac, char **av)</div><div>                                         strerror(TC[i].error));</div><div>                        }</div><div>                }</div><div>-               /* cleanup things in case we are looping */</div><div>-               for (j = fd1; j < maxfd; j++) {</div><div>-                       sprintf(fname, "dup201.%d.%d", j, mypid);</div><div>-                       (void)close(j);</div><div>-                       (void)unlink(fname);</div><div>-               }</div><div>        }</div><div>        cleanup();</div><div><br></div><div>@@ -163,7 +151,6 @@ void setup(void)</div><div><br></div><div>        /* get some test specific values */</div><div>        maxfd = getdtablesize();</div><div>-       mypid = getpid();</div><div> }</div><div><br></div><div> /*</div><div>@@ -172,6 +159,5 @@ void setup(void)</div><div>  */</div><div> void cleanup(void)</div><div> {</div><div>-</div><div>        tst_rmdir();</div><div> }</div></div><div><br></div></div>