Re: Surviving /dev/null disappearance

From: David Taylor <davidt_at_yadt.co.uk>
Date: Fri, 6 Apr 2007 12:30:48 +0100
On Wed, 04 Apr 2007, Maxim Sobolev wrote:
> Chuck Swiger wrote:
> >Andrew Pantyukhin wrote:
> >>On 4/3/07, Maxim Sobolev <sobomax_at_freebsd.org> wrote:
> >>>Patch ld(1) to detect the condition and don't unlink the device node?
> >>
> >>Yes, but there has to be a generic solution, so that
> >>we don't reinvent the wheel for every one of the
> >>thousands apps that may do this.
> >>
> >>Isn't there some safety-net wrapper function that
> >>refuses to remove device nodes and maybe some other
> >>types of files?
> >
> >Why not set a filesystem flag like schg on device nodes under a devfs 
> >tree...?
> 
> Well, I suspect that it may cause ld(1) fail instead. What we want it to 
> do is to not perform unlink(2) before open(2) when -o argument is device 
> node.

I think calling ld with it's output set to a device node is basically
pilot error.  ld unlinks files rather than truncating them for good
reasons --- to avoid overwriting libraries that are in use (the unlinked
file is still around on disk until the last fd referencing it is closed).

-- 
David Taylor
Received on Fri Apr 06 2007 - 09:52:47 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:07 UTC