hugemmap/hugemmap05.c: fix warnings in cleanup()
PATCH 1/1 hugemmap/hugemmap05.c: fix warnings in cleanup()
1) We only destroy the shared memory segment if it was still created.
2) We only close and delete the test file if it was still created and opened.
Signed-off-by Xiao Yang <[email protected]>
--- testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c +3 -2
@@ -178,9 +178,10 @@ static void test_overcommit(void)static void cleanup (void ) { -if (opt_shmid) { +if (opt_shmid && shmid !=-1 )SAFE_SHMCTL (shmid,IPC_RMID ,NULL ); - }else { + +if (!opt_shmid && fd !=-1 ) {SAFE_CLOSE (fd);SAFE_UNLINK (TEST_FILE ); }
Signature · 1 line
1.8.3.1
PATCH 1/1 hugemmap/hugemmap05.c: fix warnings in cleanup()
After applying this patch, the warning is gone. Thanks!
safe_macros.c:62: WARN: hugemmap05.c:184: close(-1) failed: EBADF safe_macros.c:360: WARN: hugemmap05.c:185: unlink(hugemmap05/file)
failed: ENOENT
Signature · 2 lines
Li Wang [email protected]
PATCH 1/1 hugemmap/hugemmap05.c: fix warnings in cleanup()
In reply to Xiao YangHi!
Pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]