On 12/23/2011 12:44 AM, Cyril Hrubis wrote: > Hi! >> Sometimes `if (access(...) && errno == ENOENT)' doesn't work due to >> errno not captures correctly from access() exection. This patch put them >> into 2 nested if-condition statements. >> >> Signed-off-by: Caspar Zhang <cas...@casparzhang.com> >> --- >> testcases/kernel/mem/zram/zram01.c | 20 ++++++++++++++------ >> 1 files changed, 14 insertions(+), 6 deletions(-) >> > >> diff --git a/testcases/kernel/mem/zram/zram01.c >> b/testcases/kernel/mem/zram/zram01.c >> index 63437c1..c382525 100644 >> --- a/testcases/kernel/mem/zram/zram01.c >> +++ b/testcases/kernel/mem/zram/zram01.c >> @@ -106,16 +106,24 @@ int main(int argc, char *argv[]) >> >> void setup(void) >> { >> + int retried = 0; >> + >> tst_require_root(NULL); >> >> - if (access(PATH_ZRAM, R_OK|W_OK|X_OK) == -1 && errno == ENOENT) { > > This one keeps me wondering. What exactly is wrong with this line? > >
This line doesn't check the situation when `access() == -1 && errno != ENOENT`; and the other line doesn't check when `access() == 0` situation correctly. I need to update the commit message to make it clear... Thanks, Caspar ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list