Problem using mandatory locks (other apps can read/delete etc)
forgot to cc this to the list, ahem..
------------- Forwarded message follows -------------
Quoted 7 lines
Quoted 3 lines
(maybe i could get along with just chmod-ing the file to deny everyone delete)
But remember that nobody can delete a file anyway. The system deletes the file of its own volition. All a user can do is remove a link to it from a directory, and it's the permissions on the directory, not on the file,
that
Quoted 1 line
control your ability to modify the directory. If you're trying to
preserve
Quoted 3 lines
the contents of the directory, either by locking or by permissions, you have to look at the directory, not the file to which the directory refers.
what i am trying to do is prevent file corruption on files shared between several processes, not all of which care one bit about (advisory) locking. I cant change the other programs in all cases, so i need to really enforce it.
Quoted 10 lines
Quoted 6 lines
if I read the lock using
F_GETLKfrom another process I see the set write lock by the correct PID. This is identical in both (mand & non-mand) cases.but still, in both cases, i am able to read the file (more, display, cat etc).
I'm not really clear on whether you tried to lock the file for read, as I suggested. In the advisory lock case, you can obviously read the file in spite of the write lock. But can you get a read lock in spite of the
write
Quoted 4 lines
lock? I don't think any of the programs you mentioned attempt to lock the file.
I thought reading the lock would essentially do the same thing, confirm the lock was really set. (i already had that little program, call me lazy..)
If i try to set a read lock after i set a write lock (for program see first post) i get EAGAIN. Which is the correct error afaik?
Signature · 9 lines
NeoMail - Webmail that doesn't suck... as much. http://neomail.sourceforge.net -- NeoMail - Webmail that doesn't suck... as much. http://neomail.sourceforge.net