blob: 7c38872215bd785e7c174c8edde881f1e5ebe83a [file] [log] [blame]
// NACL MOD TRACK "third_party/nacl-glibc/sysdeps/nacl/xstat.c"
#include <errno.h>
#include <sys/stat.h>
#include <nacl_stat.h>
#include <irt_syscalls.h>
int stat(const char *path, struct stat *buf)
{
if (buf == NULL || path == NULL)
{
errno = EFAULT;
return -1;
}
struct nacl_abi_stat st;
int result = __nacl_irt_stat (path, &st);
if (result != 0)
{
errno = result;
return -1;
}
else
{
__nacl_abi_stat_to_stat (&st, buf);
return 0;
}
}