repo.or.cz
/
tftp-hpa.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Update version for release
[tftp-hpa.git]
/
lib
/
dup2.c
blob
bdf33250d67e0b45a26fe378256a6f1a72bf370d
1
/*
2
* dup2.c
3
*
4
* Ersatz dup2() for really ancient systems
5
*/
6
7
#include
"config.h"
8
9
int
dup2
(
int
oldfd
,
int
newfd
)
10
{
11
int
rv
,
nfd
;
12
13
close
(
newfd
);
14
15
nfd
=
rv
=
dup
(
oldfd
);
16
17
if
(
rv
>=
0
&&
rv
!=
newfd
) {
18
rv
=
dup2
(
oldfd
,
newfd
);
19
close
(
nfd
);
20
}
21
22
return
rv
;
23
}
24
25