On Mar 6, 2016, at 10:31 AM, Ken Hornstein <kenh(_at_)pobox(_dot_)com> wrote:
(although I see that it uses creat() to truncate a file, rather than
ftruncate(); that seems weird to me?).
And it's a bug it closes creat's FD, freeing the lock.
Oh, yes, that happens! Good catch!
Is this an instance of fcntl's completely braindead locking behaviour? To
quite FreeBSD fcntl(2):
This interface follows the completely stupid semantics of System V and
IEEE Std 1003.1-1988 (``POSIX.1'') that require that all locks associated
with a file for a given process are removed when any file descriptor for
that file is closed by that process. This semantic means that applica-
tions must be aware of any files that a subroutine library may access
This is why I wanted to outlaw the use of fcntl() locking altogether.
Unfortunately, sometimes even that isn't good enough. Solaris' flock(3) calls
fcntl(2) internally. (I should see if Illumos has finally fixed this.)
You can't make this stuff up.
--lyndon
_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers