X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Fnotification%2Fnotification.c;h=07a8bb464826cea53821276af8db158e2813cc25;hb=aa0a9e96a728e6a4794f08bbb4df684e3274a3d9;hp=3bcffdda3f0bbc99cb91d16ba7f65d8a8690e948;hpb=c70fe895864e27ac4426ee2e92d5c9f168d0325a;p=lttng-tools.git diff --git a/tests/regression/tools/notification/notification.c b/tests/regression/tools/notification/notification.c index 3bcffdda3..07a8bb464 100644 --- a/tests/regression/tools/notification/notification.c +++ b/tests/regression/tools/notification/notification.c @@ -74,16 +74,31 @@ void wait_on_file(const char *path, bool file_exist) ret = stat(path, &buf); if (ret == -1 && errno == ENOENT) { if (file_exist) { - (void) poll(NULL, 0, 10); /* 10 ms delay */ - continue; /* retry */ + /* + * The file does not exist. wait a bit and + * continue looping until it does. + */ + (void) poll(NULL, 0, 10); + continue; } - break; /* File does not exist */ + + /* + * File does not exist and the exit condition we want. + * Break from the loop and return. + */ + break; } if (ret) { perror("stat"); exit(EXIT_FAILURE); } - break; /* found */ + /* + * stat() returned 0, so the file exists. break now only if + * that's the exit condition we want. + */ + if (file_exist) { + break; + } } }