# mutt_dotlock(1) - man - phpMan

[dotlock(1)](https://www.chedong.com/phpMan.php/man/dotlock/1/markdown)                                  User Manuals                                  [dotlock(1)](https://www.chedong.com/phpMan.php/man/dotlock/1/markdown)



## NAME
       mutt_dotlock - Lock mail spool files.

## SYNOPSIS
       **mutt**___**dotlock** [-t|-f|-u|-d] [-p] [-r _retries_] _file_

## DESCRIPTION
       **mutt**___**dotlock**  implements the traditional mail spool file locking method: To lock _file_, a file
       named _file_.lock is created. The program operates with group mail privileges if necessary.

## OPTIONS
       -t     Just try.  **mutt**___**dotlock** won't actually lock a file, but inform the invoking process if
              it's at all possible to lock _file_.

       -f     Force  the lock.  If another process holds a lock on _file_ longer than a certain amount
              of time, **mutt**___**dotlock** will break that lock by removing the lockfile.

       -u     Unlock.  **mutt**___**dotlock** will remove _file_.lock.

       -d     Delete.  **mutt**___**dotlock** will lock _file_, remove it if it has length 0, and afterwards re‐
              move _file_.lock.

       -p     Use privileges.  If given this option, **mutt**___**dotlock** will operate with group mail priv‐
              ileges when creating and deleting lock files.

       -r _retries_
              This command line option tells **mutt**___**dotlock** to try locking _retries_ times before giving
              up or (if invoked with the **-f** command line option) break a lock.  The default value is
              5.  **mutt**___**dotlock** waits one second between successive locking attempts.

## FILES
       _file_.lock
              The lock file **mutt**___**dotlock** generates.

## SEE ALSO
       [**fcntl**(2)](https://www.chedong.com/phpMan.php/man/fcntl/2/markdown), [**flock**(2)](https://www.chedong.com/phpMan.php/man/flock/2/markdown), [**lockfile**(1)](https://www.chedong.com/phpMan.php/man/lockfile/1/markdown), [**mutt**(1)](https://www.chedong.com/phpMan.php/man/mutt/1/markdown)

## DIAGNOSTICS
       **mutt**___**dotlock** gives all diagnostics in its return values:

       **0** **-** **DL**___**EX**___**OK**
              The program was successful.

       **1** **-** **DL**___**EX**___**ERROR**
              An unspecified error such as bad command line parameters, lack of  system  memory  and
              the like has occurred.

       **3** **-** **DL**___**EX**___**EXIST**
              The  user  wants  to lock a file which has been locked by another process already.  If
              **mutt**___**dotlock** is invoked with the **-f** command line option, **mutt**___**dotlock**  won't  generate
              this error, but break other processes' locks.

       **4** **-** **DL**___**EX**___**NEED**___**RPIVS**
              This  return  value  only  occurs if **mutt**___**dotlock** has been invoked with the **-t** command
              line option.  It means that **mutt**___**dotlock** will have to use its group mail privileges to
              lock _file_.

       **5** **-** **DL**___**EX**___**IMPOSSIBLE**
              This  return  value  only  occurs if **mutt**___**dotlock** has been invoked with the **-t** command
              line option.  It means that **mutt**___**dotlock** is unable to lock _file_ even with  group  mail
              privileges.

## NOTES
       **mutt**___**dotlock**  tries  to implement an NFS-safe dotlocking method which was borrowed from **lock**‐‐
       **file** (1).

       If the user can't open _file_ for reading with his normal privileges, **mutt**___**dotlock** will  return
       the  **DL**___**EX**___**ERROR**  exit  value  to avoid certain attacks against other users' spool files. The
       code carefully avoids race conditions when checking permissions; for details of all this  see
       the comments in dotlock.c.

## HISTORY
       **mutt**___**dotlock**  is part of the Mutt mail user agent package.  It has been created to avoid run‐
       ning mutt with group mail privileges.

## AUTHOR
       Thomas Roessler <<roessler@does-not-exist.org>>



Unix                                         AUGUST 1999                                  [dotlock(1)](https://www.chedong.com/phpMan.php/man/dotlock/1/markdown)
