elks-enhanced
public
Read
Owner: themaster
Branch: master
Commits: 6893
Updated: 2026-04-19 00:15
Git CLI clone URL
git clone https://www.xt-emporium.com/git/elks-enhanced.git
Fullscreen desktop URL
Code
Commits
History
Branches
Bug Reports
Discussions
Compare
Settings
elks-enhanced
/
libc
/
system
/
dup.c
File editor
#ifdef L_dup #include <sys/param.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> /* This is horribly complicated, there _must_ be a better way! */ int dup(int fd) { int nfd; int oerr = errno; for(nfd=0; nfd<NR_OPEN; nfd++) { if( fcntl(nfd, F_GETFD) < 0 ) break; } if( nfd == NR_OPEN ) { errno = EMFILE ; return -1; } errno = oerr; if( fcntl(fd, F_DUPFD, nfd) < 0 ) { if( errno == EINVAL ) errno = EMFILE; return -1; } return nfd; } #endif
Commit message
This repository is read-only for this account.
Repository snapshot
Current branch
master
Visibility
public
Your access
Read
Remote
Configured
File activity
View file history