On 02/13/2012 02:09 PM, Pádraig Brady wrote: >> BTW: shouldn't >> > echo abcdefghijklm | src/dd bs=5 seek=8 oflag=seek_bytes >> > receive EPIPE? When run on a terminal, dd waits in read() forever. > True. That's because we try to seek using read() > on non seekable files, and stdout is readable by default, > so we'll hang waiting for input from the terminal. > I.E. this will block: > > dd seek=1 if=/dev/null > > Not sure what to do there.
Hmm, the process writing into the pipe has already exited, so I don't get why read() doesn't return eof. Using O_NONBLOCK if reading from stdin? Strangely, using iflag=nonblock also blocks ;-( echo abcdefghijklm | src/dd bs=5 seek=8 iflag=nonblock Have a nice day, Berny
