From: tangchen <tan...@cn...> - 2011-06-01 06:38:04
|
On 06/01/2011 02:04 PM, Garrett Cooper wrote: > On Tue, May 31, 2011 at 11:04 PM, tangchen <tan...@cn...> 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 <tan...@cn...> --- 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 |