Check file access rights before opening
Detect and handle file operation errors
Do not use file handles after the file they refer to has been closed
Do not remove or rename open files
Open files with as few privileges as necessary
Validate path and filename parameters supplied to file functions