Sign in
nest-open-source
/
nest-learning-thermostat
/
5.0.2
/
tftp-hpa
/
9ff303d2392d4001e76f6211ad80bfb1b54510c6
/
.
/
tftp-hpa-5.0
/
lib
/
dup2.c
blob: bba45c419dca9b103dd4e1536f60ad68122d9075 [
file
] [
log
] [
blame
]
/*
* 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
;
}