Source-Changes archive

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

Re: CVS commit: src/bin/dd



On Sat, Nov 15, 2003 at 12:44:54PM +0000, David Sainty wrote:
> 
> Module Name:  src
> Committed By: dsainty
> Date:         Sat Nov 15 12:44:54 UTC 2003
> 
> Modified Files:
>       src/bin/dd: dd.c
> 
> Log Message:
> Avoid corrupting the dd(1) IO streams.  This would happen by accidentally
> outputting to the files being manipulated by opening a file in the standard IO
> descriptor space.  In particular, an output file unlucky enough to be sitting
> on descriptor 2 (stderr) is certain to be corrupted.
> 
> Addresses PR bin/8521, and passes the recently committed regression test
> "bin/dd".

What is wrong with:
        new_fd = fcntl(fd, F_DUPFD, 3);
        close(fd);
        fd = newfd;

        David

-- 
David Laight: david%l8s.co.uk@localhost



Home | Main Index | Thread Index | Old Index