diff --git a/libc/unistd/stat.c b/libc/unistd/stat.c index a09058d9..b40c6190 100644 --- a/libc/unistd/stat.c +++ b/libc/unistd/stat.c @@ -12,9 +12,9 @@ int stat(const char *file, struct stat *st){ if (ret >= 0) { return ret; } else { - errno = ENOENT; /* meh */ + errno = -ret; memset(st, 0x00, sizeof(struct stat)); - return ret;; + return -1; } } @@ -25,6 +25,6 @@ int lstat(const char *path, struct stat *st) { } else { errno = -ret; memset(st, 0x00, sizeof(struct stat)); - return ret; + return -1; } }