From: Wanlong G. <gao...@cn...> - 2012-04-11 11:30:13
|
On 04/11/2012 06:03 PM, Caspar Zhang wrote: > On 04/10/2012 10:54 AM, Wanlong Gao wrote: > >> testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c | 14 +++++++++++--- >> 1 file changed, 11 insertions(+), 3 deletions(-) >> >> diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c >> index 0f5f7d2..51740a7 100644 >> --- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c >> +++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c >> @@ -60,7 +60,7 @@ int TST_TOTAL = 4; >> >> static size_t shm_size; >> static int shm_id_1 = -1; >> -static int shm_id_2 = -1; >> +static int shm_nonexistent_key = -1; > > The rename looks good, if only there is no another `shm_id_2`. The name > `shm_id_2` below caused a little confusion when reviewing the patch (I > thought it was replaced by `shm_nonexistent_key`.. hmmm). But overall, > the patch looks good to me. yeah, pushed, thanks, Wanlong Gao > > Reviewed-by: Caspar Zhang <ca...@ca...> > >> static key_t shmkey2; > [snip] >> char *msg; >> + int shm_id_2 = -1; >> >> msg = parse_opts(ac, av, options, &help); >> if (msg != NULL) >> @@ -103,6 +104,13 @@ int main(int ac, char **av) >> Tst_count = 0; >> >> for (i = 0; i < TST_TOTAL; i++) { >> + /* If this key is existent, just remove it */ >> + if (*TC[i].skey == -1) { >> + shm_id_2 = shmget(*(TC[i].skey), 0, 0); >> + if (shm_id_2 != -1) >> + shmctl(shm_id_2, IPC_RMID, NULL); >> + } >> + >> TEST(shmget(*(TC[i].skey), TC[i].size_coe*shm_size, >> TC[i].flags)); >> if (TEST_RETURN != -1) { > > |