- pos = mlua_value(cmd, sizeof(cmd), "madmutt", "dotlock");
-
- snprintf(cmd + pos, sizeof(cmd) - pos,
- " %s%s%s%s%s%s%s",
- flags & DL_FL_TRY ? "-t " : "",
- flags & DL_FL_UNLOCK ? "-u " : "",
- flags & DL_FL_USEPRIV ? "-p " : "",
- flags & DL_FL_FORCE ? "-f " : "",
- flags & DL_FL_UNLINK ? "-d " : "",
- flags & DL_FL_RETRY ? r : "", f);
-
- return mutt_system (cmd);
-}
-
-static int dotlock_file (const char *path, int retry)
-{
- int r;
- int flags = DL_FL_USEPRIV | DL_FL_RETRY;
-
- if (retry)
- retry = 1;
-
-retry_lock:
- if ((r = invoke_dotlock (path, flags, retry)) == DL_EX_EXIST) {
- if (!option (OPTNOCURSES)) {
- char msg[LONG_STRING];
-
- snprintf (msg, sizeof (msg),
- _("Lock count exceeded, remove lock for %s?"), path);
- if (retry && mutt_yesorno (msg, M_YES) == M_YES) {
- flags |= DL_FL_FORCE;
- retry--;
- mutt_clear_error ();
- goto retry_lock;
- }
+ if (lockfile_create(lockfile, retry ? 1 : 0, 0)) {
+ if (retry)
+ mutt_error (_("Can't dotlock %s.\n"), lockfile);