X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Ftime%2F__map_file.c;h=b91eb8edb986438c75152d737e6f4734b8e04fb1;hb=cfa0a54c082d41db6446638eed1d57f163434092;hp=b6bf272a6fb209792af56e79fa48d811898670fe;hpb=1cc81f5cb0df2b66a795ff0c26d7bbc4d16e13c6;p=musl diff --git a/src/time/__map_file.c b/src/time/__map_file.c index b6bf272a..b91eb8ed 100644 --- a/src/time/__map_file.c +++ b/src/time/__map_file.c @@ -9,12 +9,12 @@ const char unsigned *__map_file(const char *pathname, size_t *size) { struct stat st; const unsigned char *map = MAP_FAILED; - int flags = O_RDONLY|O_LARGEFILE|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK; - int fd = __syscall(SYS_open, pathname, flags); + int fd = __sys_open(pathname, O_RDONLY|O_CLOEXEC|O_NONBLOCK); if (fd < 0) return 0; - if (!__syscall(SYS_fstat, fd, &st)) + if (!__syscall(SYS_fstat, fd, &st)) { map = __mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0); - __syscall(SYS_close); - *size = st.st_size; + *size = st.st_size; + } + __syscall(SYS_close, fd); return map == MAP_FAILED ? 0 : map; }