"HARDY, Steven" <[EMAIL PROTECTED]> wrote: > I'm experiencing some problems trying to use "dd" to load firmware onto a > device, and I guess this could be a potential bug? > > - dd if=myfirmware.bin of=/dev/mydevice > > The problem is that /dev/mydevice returns -EIO if the load has been > unsuccessful, but dd always returns 0 whether this occurs or not. > > I was expecting dd to explicitly close the if=/of= file descriptors and > return any errors, but looking at the code it seems to close only > stdin/stdout, and does not check for successful close of the input and > output files?? > > I am using coreutils-5.9.3 - any help or suggestions much appreciated.
If you're using Linux, try using strace on it: strace -o log dd if=myfirmware.bin of=/dev/mydevice You'll see that dd reopens stdin on the if=...-specified name, and reopens stdout on the of=...-specified name. So when it closes STDIN_FILENO, it's actually closing a file handle that is open on your input file. _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils