dns: fix workaround for systems defaulting to ipv6-only sockets
[musl] / src / stat / fstat.c
index 5f64330..fd28b8a 100644 (file)
@@ -1,10 +1,13 @@
+#define _BSD_SOURCE
 #include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
 #include "syscall.h"
-#include "libc.h"
 
-int fstat(int fd, struct stat *buf)
+int __fstat(int fd, struct stat *st)
 {
-       return syscall2(__NR_fstat64, fd, (long)buf);
+       if (fd<0) return __syscall_ret(-EBADF);
+       return __fstatat(fd, "", st, AT_EMPTY_PATH);
 }
 
-LFS64(fstat);
+weak_alias(__fstat, fstat);