tftp-hpa-google/lib/dup2.c
H. Peter Anvin 22accddda0 Reformat the source code
The source code was a mix of different styles; normalize on NASM
style; basically K&R style with 4 space indentation.
2008-07-08 17:14:44 -04:00

23 lines
295 B
C

/*
* dup2.c
*
* Ersatz dup2() for really ancient systems
*/
#include "config.h"
int dup2(int oldfd, int newfd)
{
int rv, nfd;
close(newfd);
nfd = rv = dup(oldfd);
if (rv >= 0 && rv != newfd) {
rv = dup2(oldfd, newfd);
close(nfd);
}
return rv;
}