From 6e9d2370c7559af80b32a91f20898f41597e093b Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 4 May 2022 10:53:01 -0400 Subject: use __fstat instead of __fstatat with AT_EMPTY_PATH in __map_file this isolates knowledge of the nonstandard AT_EMPTY_PATH extension to one place and returns __map_file to its prior simplicity. --- src/time/__map_file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/time/__map_file.c b/src/time/__map_file.c index 8ef36138..c2b29fe8 100644 --- a/src/time/__map_file.c +++ b/src/time/__map_file.c @@ -1,4 +1,3 @@ -#define _BSD_SOURCE #include #include #include @@ -10,7 +9,7 @@ const char unsigned *__map_file(const char *pathname, size_t *size) const unsigned char *map = MAP_FAILED; int fd = sys_open(pathname, O_RDONLY|O_CLOEXEC|O_NONBLOCK); if (fd < 0) return 0; - if (!__fstatat(fd, "", &st, AT_EMPTY_PATH)) { + if (!__fstat(fd, &st)) { map = __mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0); *size = st.st_size; } -- cgit v1.2.1