dd(1) trashes file if input and output same

Dave Martindale dmmartindale at watcgl.UUCP
Mon Mar 26 16:13:06 AEST 1984


If you really want, you can wait until the input and output files are open
and then do fstat on both of them and compare inumbers and devs.
This would catch the case of dd if=foo >foo

However, I'm going to do none of this.  Dd is often used to copy data
from raw devices, and sometimes it makes sense to have the input and
output "files" the same if they are in fact not files but special files.



More information about the Comp.bugs.4bsd.ucb-fixes mailing list