Permalink
Browse files

Add error handling for when readdir_r() fails

  • Loading branch information...
1 parent aa45fc7 commit b3e58d2068bf2955cb98fbadd6409e7ec5b84d22 @dbussink dbussink committed Feb 9, 2014
Showing with 3 additions and 1 deletion.
  1. +3 −1 vm/builtin/dir.cpp
View
@@ -81,7 +81,9 @@ namespace rubinius {
struct dirent ent;
struct dirent* entp = &ent;
- readdir_r(os_, entp, &entp);
+ if(int erno = readdir_r(os_, entp, &entp)) {
+ Exception::errno_error(state, "readdir_r(3) failed", erno);
+ }
if(!entp) return cNil;
return String::create(state, ent.d_name);

0 comments on commit b3e58d2

Please sign in to comment.