"Andresen,Jason R." wrote:

> Garrett Wollman wrote:
> >
> > <<On Thu, 16 Nov 2000 15:18:09 +0000, void <[EMAIL PROTECTED]> said:
> >
> > > I have a similar problem -- every time I make world, perms on /var/mail
> > > get set to 775.  Mutt considers my mailbox read-only until I change it
> > > to 1777.
> >
> > It is misconfigured (or perhaps just broken).  1777 mode for /var/mail
> > is insecure, but was necessary in the mists of ancient past, before
> > UNIX learned to do file locking.  Unless your mail spool is shared
> > over NFS (don't do that), locking is reliable and .lock files should
> > never be used or relied upon.
>
> Not the FreeBSD's file locking works anyway.
> Here's the results from a test of the below program:

You test case is incorrect. Following quote from flock(2) explains why:
[...]
NOTES
     Locks are on files, not file descriptors.  That is, file descriptors du-
     plicated through dup(2) or fork(2) do not result in multiple instances of
     a lock, but rather multiple references to a single lock.  If a process
     holding a lock on a file forks and the child explicitly unlocks the file,
     the parent will lose its lock.
[...]

-Maxim



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to