pgmoneta / pgmoneta

Backup / restore solution for PostgreSQL
https://pgmoneta.github.io
BSD 3-Clause "New" or "Revised" License
121 stars 38 forks source link

Broken for loop #250

Closed HazemRawi closed 1 month ago

HazemRawi commented 1 month ago

in main.c line 1655 there is a broken for loop that is never got executed because of the contradicted initialization of j and the j==-1 condition

            follow = -1;

            for (int j = 0; j == -1 && j < config->number_of_servers; j++)
            {
               if (!strcmp(config->servers[j].follow, config->servers[i].name))
               {
                  follow = j;
               }
            }

I think the author was about to write follow instead of j in the preceding condition.