I've seen a number of scripts (mostly poorly written ones) blindly overwriting files, without actually checking if it should (or can) be read/overwritten.
Is it worth using alot of checking (file existence, file permissions, files vs directories, files being (sym)links, etc.) before doing some important file I/O?
One of the more common exploits appears to be, changing a file by a (sym)link to another file, and hence accessing a different file than the one intended.