Skip to content

Commit 9c1f35f

Browse files
committed
---
yaml --- r: 5111 b: refs/heads/master c: baa1e87 h: refs/heads/master i: 5109: be9cf3b 5107: 3d04a46 5103: f971929 v: v3
1 parent 7f1c170 commit 9c1f35f

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 4951bb8bfc1cfcc7bc0df9ebdaf86610a2c2658f
2+
refs/heads/master: baa1e8790d6c8d04de5a371a1c231ca9f2caa3b0

trunk/src/rt/rust_builtin.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,9 @@ rust_dirent_filename(rust_task *task, dirent* ent) {
446446
extern "C" CDECL int
447447
rust_file_is_dir(rust_task *task, rust_str *path) {
448448
struct stat buf;
449-
stat((char*)path->data, &buf);
449+
if (stat((char*)path->data, &buf)) {
450+
return 0;
451+
}
450452
return S_ISDIR(buf.st_mode);
451453
}
452454

trunk/src/test/stdtest/fs.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@ fn test_connect() {
1414
#[test]
1515
fn test_list_dir_no_invalid_memory_access() { fs::list_dir(~"."); }
1616

17+
#[test]
18+
fn file_is_dir() {
19+
assert fs::file_is_dir(~".");
20+
assert !fs::file_is_dir(~"test/stdtest/fs.rs");
21+
}

0 commit comments

Comments
 (0)