X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Fnotification%2Fnotification.c;h=b6ef0df4f1dc6c7ef9f751ad4a2a54b7d15e4745;hb=9090be90d58940074561e08172fc73c4b228617c;hp=e255bed37cc1e6d6ed836793bc6a15a616722650;hpb=4e4aceb7f943c0017786c6a8ef83e7a3d86c334f;p=lttng-tools.git diff --git a/tests/regression/tools/notification/notification.c b/tests/regression/tools/notification/notification.c index e255bed37..b6ef0df4f 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; + } } }