minor code cleanup
short-circuit case when target file is /dev/null
minor code optimization