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

Re: passwd file locking (was Re: New!!!: Base-passwd 2.0)



[ Please don't Cc: me when replying to my message on a mailing list. ]

Marek Michalkiewicz:
> I'm pretty sure that rename() is atomic.

rename(2) indicates it is:

       If newpath already exists it will be automically overwrit­
       ten (subject to a few conditions - see ERRORS  below),  so
       that there is no point at which another process attempting
       to access newpath will find it missing.

> BTW, I wonder why it has been decided to use the *.lock convention for
> locking mailboxes.

I don't know. However, it does make it possible to write shell
scripts to operate on mailboxes:

	if lockfile $MAIL.lock
	then
		gzip -9 < $MAIL >> newmail.gz
		> $MAIL
		rm -f $MAIL.lock
	fi

(lockfile comes with procmail.)

-- 
Please read <http://www.iki.fi/liw/mail-to-lasu.html> before mailing me.
Please don't Cc: me when replying to my message on a mailing list.


Attachment: pgpx2Ql5pgaKV.pgp
Description: PGP signature


Reply to: