From: Shuang Qiu <shuang....@oracle.com>

It is not expected to use stdout as the file description to test the
system call fstatfs().Using ltp temporary file instead.

Signed-off-by: Shuang Qiu <shuang....@oracle.com>
---
 testcases/kernel/syscalls/fstatfs/fstatfs02.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/testcases/kernel/syscalls/fstatfs/fstatfs02.c 
b/testcases/kernel/syscalls/fstatfs/fstatfs02.c
index f851c97..9e00a67 100644
--- a/testcases/kernel/syscalls/fstatfs/fstatfs02.c
+++ b/testcases/kernel/syscalls/fstatfs/fstatfs02.c
@@ -27,6 +27,7 @@
 #include <errno.h>
 #include "test.h"
 #include "usctest.h"
+#include "safe_macros.h"
 
 static void setup(void);
 static void cleanup(void);
@@ -48,6 +49,7 @@ static struct test_case_t {
 #ifndef UCLINUX
            /* Skip since uClinux does not implement memory protection */
            /* EFAULT - address for buf is invalid */
+           /* Using the init "1" as fd is not actually expected,will assign a 
tmp file later */
        {
        1, (void *)-1, EFAULT}
 #endif
@@ -107,11 +109,19 @@ static void setup(void)
        TEST_PAUSE;
 
        tst_tmpdir();
+#ifndef UCLINUX
+       TC[1].fd = SAFE_OPEN(cleanup, "tempfile", O_RDWR | O_CREAT, 0700);
+#endif
 }
 
 static void cleanup(void)
 {
        TEST_CLEANUP;
 
+#ifndef UCLINUX
+       if (TC[1].fd > 0 && close(TC[1].fd))
+               tst_resm(TWARN | TERRNO, "Failed to close fd");
+#endif
+
        tst_rmdir();
 }
-- 
1.7.9.5


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to