Chromium Code Reviews| Index: sysdeps/nacl/sysdep.h |
| diff --git a/sysdeps/nacl/sysdep.h b/sysdeps/nacl/sysdep.h |
| index 2e2b8b09bd908bccc50e9d42a2845249896d1a2c..cef81c316e45aca7d773df8c7695d6f6c1920a8c 100644 |
| --- a/sysdeps/nacl/sysdep.h |
| +++ b/sysdeps/nacl/sysdep.h |
| @@ -5,6 +5,7 @@ |
| #include <futex_emulation.h> |
| #include <irt_syscalls.h> |
| #include <lowlevellock.h> |
| +#include <string.h> |
| /* Implementation of all syscalls for use in platform- and OS- independent code |
| as inline functions. Each function translates the syscall arguments into IRT |
| @@ -598,8 +599,7 @@ INTERNAL_SYSCALL_getcwd_2 (int *err, char *buf, size_t size) |
| if (*err) { |
| return 0; |
| } |
| - for (len = 0; len < size && buf[len] != '\0'; ++len); |
| - return len; |
| + return __strnlen(buf, size) + 1; |
|
Roland McGrath
2014/12/08 22:57:06
I think this should be size - 1: strnlen returns M
|
| } |
| __extern_always_inline gid_t |