Index: native_client_sdk/src/libraries/nacl_io/getdents_helper.cc |
diff --git a/native_client_sdk/src/libraries/nacl_io/getdents_helper.cc b/native_client_sdk/src/libraries/nacl_io/getdents_helper.cc |
index 87dc32de4d3c2b4d11b7ad7689e74fdf284c78e2..47cc694b792d7036f9799edc18891055fff75864 100644 |
--- a/native_client_sdk/src/libraries/nacl_io/getdents_helper.cc |
+++ b/native_client_sdk/src/libraries/nacl_io/getdents_helper.cc |
@@ -10,6 +10,8 @@ |
#include <algorithm> |
+#include "nacl_io/log.h" |
+ |
#include "sdk_util/macros.h" |
namespace nacl_io { |
@@ -63,12 +65,16 @@ Error GetDentsHelper::GetDents(size_t offs, |
*out_bytes = 0; |
// If the buffer pointer is invalid, fail |
- if (NULL == pdir) |
+ if (NULL == pdir) { |
+ LOG_TRACE("dirent pointer is NULL."); |
return EINVAL; |
+ } |
// If the buffer is too small, fail |
- if (size < sizeof(dirent)) |
+ if (size < sizeof(dirent)) { |
+ LOG_TRACE("dirent buffer size is too small: %d < %d", size, sizeof(dirent)); |
return EINVAL; |
+ } |
// Force size to a multiple of dirent |
size -= size % sizeof(dirent); |