libc: stat/lstat must return -1 on error
This commit is contained in:
parent
8d57dafc08
commit
7c8a98e957
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user