mirror of
https://kernel.googlesource.com/pub/scm/network/tftp/tftp-hpa
synced 2025-04-29 19:39:54 +03:00
Use replacement library functions to daemonize, rather than #ifdef hell
This commit is contained in:
parent
6124dcbe2d
commit
059de7ce20
4 changed files with 70 additions and 33 deletions
25
lib/dup2.c
Normal file
25
lib/dup2.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue