infra: fix potential endless loop

Thisd unlikely, but may happen when /mars is defective.
This commit is contained in:
Thomas Schoebel-Theuer 2022-01-12 15:06:10 +01:00 committed by Thomas Schoebel-Theuer
parent 707dc32c54
commit bec3ebf006

View File

@ -1091,6 +1091,7 @@ int ordered_symlink(const char *oldpath,
{ {
char *dir_path = NULL; char *dir_path = NULL;
int dir_len; int dir_len;
int nr_retry = 0;
int status; int status;
retry: retry:
@ -1118,7 +1119,9 @@ int ordered_symlink(const char *oldpath,
if (check >= 0) { if (check >= 0) {
brick_string_free(dir_path); brick_string_free(dir_path);
dir_path = NULL; dir_path = NULL;
goto retry; if (nr_retry++ < 3)
goto retry;
break;
} }
} }
brick_string_free(dir_path); brick_string_free(dir_path);