Check error code in rust_file_is_dir. Prevent comparison of uninitialized mem
This commit is contained in:
parent
4951bb8bfc
commit
baa1e8790d
2 changed files with 8 additions and 1 deletions
|
@ -446,7 +446,9 @@ rust_dirent_filename(rust_task *task, dirent* ent) {
|
|||
extern "C" CDECL int
|
||||
rust_file_is_dir(rust_task *task, rust_str *path) {
|
||||
struct stat buf;
|
||||
stat((char*)path->data, &buf);
|
||||
if (stat((char*)path->data, &buf)) {
|
||||
return 0;
|
||||
}
|
||||
return S_ISDIR(buf.st_mode);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue