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
/
opendir.c
File editor
#include <dirent.h> #include <errno.h> #include <fcntl.h> #include <stdlib.h> #include <sys/stat.h> #include <unistd.h> DIR * opendir(const char *dname) { int fd; DIR *p; struct stat st; if ((fd = open(dname, O_RDONLY)) < 0) return NULL; if (fstat(fd, &st) < 0 || !S_ISDIR(st.st_mode)) { close(fd); errno = ENOTDIR; return NULL; } p = malloc(sizeof(DIR) + sizeof(struct dirent)); if (p == NULL) { close(fd); errno = ENOMEM; return NULL; } p->dd_buf = (struct dirent *)((char *)p + sizeof(DIR)); p->dd_fd = fd; p->dd_loc = p->dd_size = 0; return p; }
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