X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fdirent%2Fopendir.c;h=5cb84e303feea1746c64e3b255bd7fe76389e49b;hb=4d3a162d001a93edd285fb6603a883c30ae553ba;hp=cefe6ce7a30afff25900c7309c39268e7774ab10;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl diff --git a/src/dirent/opendir.c b/src/dirent/opendir.c index cefe6ce7..5cb84e30 100644 --- a/src/dirent/opendir.c +++ b/src/dirent/opendir.c @@ -1,23 +1,19 @@ #define _GNU_SOURCE #include #include -#include -#include #include -#include -#include #include "__dirent.h" +#include "syscall.h" DIR *opendir(const char *name) { int fd; DIR *dir; - if ((fd = open(name, O_RDONLY|O_DIRECTORY)) < 0) + if ((fd = open(name, O_RDONLY|O_DIRECTORY|O_CLOEXEC)) < 0) return 0; - fcntl(fd, F_SETFD, FD_CLOEXEC); if (!(dir = calloc(1, sizeof *dir))) { - close(fd); + __syscall(SYS_close, fd); return 0; } dir->fd = fd;