Commit 06b98a9a authored by matthewturk@gmail.com's avatar matthewturk@gmail.com

[NaCl SDK] Change KernelProxy::GetCWD() to allocate path.

When supplying a zero size to getcwd() typical behavior is to allocate
internally and return a pointer.  This behavior was already implemented, but
disabled by checking if size <= 0 and erroring with EINVAL.  As size_t is
positive definite, this entire check can be removed.

R=noelallen@chromium.org, sbc@chromium.org, binji@chromium.org
BUG=

Review URL: https://codereview.chromium.org/122943005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244213 0039d316-1c4b-4281-b951-d872f2087c98
parent fed63e98
...@@ -185,6 +185,7 @@ Matheus Bratfisch <matheusbrat@gmail.com> ...@@ -185,6 +185,7 @@ Matheus Bratfisch <matheusbrat@gmail.com>
Mathias Bynens <mathias@qiwi.be> Mathias Bynens <mathias@qiwi.be>
Matt Arpidone <mma.public@gmail.com> Matt Arpidone <mma.public@gmail.com>
Matthew Robertson <matthewrobertson03@gmail.com> Matthew Robertson <matthewrobertson03@gmail.com>
Matthew Turk <matthewturk@gmail.com>
Matthew Willis <appamatto@gmail.com> Matthew Willis <appamatto@gmail.com>
Matthias Reitinger <reimarvin@gmail.com> Matthias Reitinger <reimarvin@gmail.com>
Max Perepelitsyn <pph34r@gmail.com> Max Perepelitsyn <pph34r@gmail.com>
......
...@@ -5,3 +5,4 @@ ...@@ -5,3 +5,4 @@
# Name/Organization <email address> # Name/Organization <email address>
Google Inc. native-client-discuss@google.com Google Inc. native-client-discuss@google.com
Matthew Turk <matthewturk@gmail.com>
...@@ -270,11 +270,6 @@ int KernelProxy::chdir(const char* path) { ...@@ -270,11 +270,6 @@ int KernelProxy::chdir(const char* path) {
char* KernelProxy::getcwd(char* buf, size_t size) { char* KernelProxy::getcwd(char* buf, size_t size) {
std::string cwd = GetCWD(); std::string cwd = GetCWD();
if (size <= 0) {
errno = EINVAL;
return NULL;
}
// If size is 0, allocate as much as we need. // If size is 0, allocate as much as we need.
if (size == 0) { if (size == 0) {
size = cwd.size() + 1; size = cwd.size() + 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment