bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible dd bug - no close of "if=/of=" fds


From: Jim Meyering
Subject: Re: Possible dd bug - no close of "if=/of=" fds
Date: Wed, 07 Dec 2005 16:36:20 +0100

"HARDY, Steven" <address@hidden> 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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]