bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-mailutils] Infinity loop in folder.c roll_back()


From: maks
Subject: [bug-mailutils] Infinity loop in folder.c roll_back()
Date: Wed, 16 Jul 2014 14:06:33 +0300

mh/folder.c

static void
roll_back (const char *folder_name, struct pack_tab *pack_tab, size_t i)
{
  size_t start;
  
  if (i == 0)
    return;
  
  start = i - 1;
  mu_error (_("rolling back changes..."));
  while (--i >= 0)                           // <=====
    if (pack_rename (pack_tab + i, 1))
      {
        mu_error (_("CRITICAL ERROR: Folder `%s' left in an inconsistent state, 
because an error\n"
                    "occurred while trying to roll back the changes.\n"
                    "Message range %s-%s has been renamed to %s-%s."),
                  folder_name,
                  mu_umaxtostr (0, pack_tab[0].orig),
                  mu_umaxtostr (1, pack_tab[start].orig),
                  mu_umaxtostr (2, pack_tab[0].new),
                  mu_umaxtostr (3, pack_tab[start].new));
        mu_error (_("You will have to fix it manually."));
        exit (1);
      }
  mu_error (_("folder `%s' restored successfully"), folder_name);
}

'i' is size_t that always >=0. Maybe should be "while (--i > 0)"?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]