If your filesystem is ext2/3, you can set the 'a' extended attribute using the chattr command.
From the chattr man page:
Quote:
A file with the ‘a’ attribute set can only be open in append mode for writing. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
|
That'll prevent a file from being opened for output but won't automatically change it to append (that is, it won't change an fopen's mode from 'w' to 'a', it'll just prevent the file from being overwritten).