Subject: Re: Copying to devices
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: current-users
Date: 07/30/1995 20:23:45
> If an I/O error occurs upon writing to a file (as opposed to opening
> it), then cp will remove the file.  This is true even if the file is
> a special device or named pipe.

Hm, I think this calls for a PR; IMO it should happen only if the file
did not exist before cp started up.

> My immediate problem with this is that my firewall code gets its
> filter tables reloaded by having them copied to /dev/firewall.
> [...if error, cp will then happily remove my device node...]

> - Is there anything I can do other than provide a separate binary to
>   load my filter table?

Make /dev read-only by mounting fdesc over it "-o ro,union".  Or, if
you don't want fdesc, just

	# rm /dev/firewall
	# mknod /foo/firewall ... ... ...
	# mount -t null -o ro,union /foo /dev

Or, you could kludge it by doing a mknod 2>/dev/null just before the
cp, to recreate /dev/firewall if it was blown away by a previous cp.
(Don't take this too seriously - but it certainly ought to work!)

					der Mouse