Hi,
References: <[EMAIL PROTECTED]>
Content-Disposition: inline; filename=fix-compiler-warning-ftest08.diff

Fix warning about _is_ unused variable (note the difference between "may" and 
"is" unused!).
Only child opens the file descriptor, once forked.

ftest08.c: In function 'runtest':
ftest08.c:192: warning: 'fd' is used uninitialized in this function

Valgrind spot this issue aswell:
==21058== Syscall param close(fd) contains uninitialised byte(s)
==21058==    at 0x4BD70A0: __close_nocancel (in /lib64/libc-2.4.so)
==21058==    by 0x401D0E: runtest (ftest08.c:192)
==21058==    by 0x401B10: main (ftest08.c:119)

Fix tested on SLES 10 SP2:
:~/ltp/ltp-full-20080825/:[0]# ./testcases/kernel/fs/ftest/ftest08
ftest08     1  PASS  :  Test passed

Signed-off-by: Daniel Gollub <[EMAIL PROTECTED]>

---
 testcases/kernel/fs/ftest/ftest08.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: ltp-full-20080825/testcases/kernel/fs/ftest/ftest08.c
===================================================================
--- ltp-full-20080825.orig/testcases/kernel/fs/ftest/ftest08.c
+++ ltp-full-20080825/testcases/kernel/fs/ftest/ftest08.c
@@ -187,9 +187,9 @@ int runtest()
                                tst_exit();
                        }
                        dotest(nchild, i, fd);          /* do it! */
+                       close(fd);
                        tst_exit();                     /* when done, exit */
                }
-               close(fd);
                if (child < 0) {
                        tst_resm(TINFO, "System resource may be too low, fork() 
malloc()"
                                            " etc are likely to fail.");


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to