On 06/01/2011 02:04 PM, Garrett Cooper wrote:
> On Tue, May 31, 2011 at 11:04 PM, tangchen <[email protected]> wrote:
>> Hi,
>> The comment has been followed. And one more thing, I forgot to fclose(fp), 
>> and it is done this time.
>> Here is the new patch, thanks.:)
> 
> If you're looking for file existence, there's stat(2)/fstat(2).. Those
> are a bit better to use.
OK, I changed to use stat() this time.
Thanks.:)

Signed-off-by: Tang Chen <[email protected]>
---
 testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c 
b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
index 40dedea..e59e111 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
@@ -299,8 +299,13 @@ static void setup(void)
 {
        FILE *fp;
        int fd;
+       struct stat buf;
 
        tst_require_root(NULL);
+
+       if (stat(pathover, &buf) == -1 && errno == ENOENT)
+               tst_brkm(TCONF, NULL, "File %s does not exist in the system", 
pathover);
+
        tst_sig(FORK, DEF_HANDLER, cleanup);
        TEST_PAUSE;
        tst_tmpdir();
-- 
1.7.4


-- 
Best Regards,
Tang chen

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to