truncating an open (locked) file
Gregory Kemnitz
kemnitz at mitisft.Convergent.COM
Fri May 19 05:54:04 AEST 1989
In article <269 at sawmill.UUCP>, rjk at sawmill.UUCP (Richard Kuhns) writes:
<
< [stuff deleted]
< Don't close(2) the second file descriptor! If you close *either* file
< descriptor, the lock goes away. At least, it does on a 3B1 running 3.51 --
< is this behaviour standard?
Yes. close() will free any locks on files.
<
< So now, I have a slight variation of my original question: Does anyone
< have a portable way to truncate (to size 0) an open file, which both
< maintains an existing lock on the file and doesn't waste a file
< descriptor?
<
No. There is not. Only hope: there is a truncate() and ftruncate() call
in POSIX, so there will be one in Sys V.4.
--
----------------------------------+--------------------------------------
Greg Kemnitz | "He who does not understand baseball
kemnitz at Convergent.COM | will never understand America"
| --Tocqueville
More information about the Comp.unix.questions
mailing list