libc: stat/lstat must return -1 on error

This commit is contained in:
K. Lange 2018-11-25 12:50:42 +09:00
parent 8d57dafc08
commit 7c8a98e957

View File

@ -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;
}
}