Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(997)

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc

Issue 122943005: [NaCl SDK] Change KernelProxy::GetCWD() to allocate path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding my name to root AUTHORS file Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « native_client_sdk/src/AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "nacl_io/kernel_proxy.h" 5 #include "nacl_io/kernel_proxy.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <limits.h> 10 #include <limits.h>
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 if (error) { 263 if (error) {
264 errno = error; 264 errno = error;
265 return -1; 265 return -1;
266 } 266 }
267 return 0; 267 return 0;
268 } 268 }
269 269
270 char* KernelProxy::getcwd(char* buf, size_t size) { 270 char* KernelProxy::getcwd(char* buf, size_t size) {
271 std::string cwd = GetCWD(); 271 std::string cwd = GetCWD();
272 272
273 if (size <= 0) {
274 errno = EINVAL;
275 return NULL;
276 }
277
278 // If size is 0, allocate as much as we need. 273 // If size is 0, allocate as much as we need.
279 if (size == 0) { 274 if (size == 0) {
280 size = cwd.size() + 1; 275 size = cwd.size() + 1;
281 } 276 }
282 277
283 // Verify the buffer is large enough 278 // Verify the buffer is large enough
284 if (size <= cwd.size()) { 279 if (size <= cwd.size()) {
285 errno = ERANGE; 280 errno = ERANGE;
286 return NULL; 281 return NULL;
287 } 282 }
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 errno = ENOTSOCK; 1596 errno = ENOTSOCK;
1602 return -1; 1597 return -1;
1603 } 1598 }
1604 1599
1605 return 0; 1600 return 0;
1606 } 1601 }
1607 1602
1608 #endif // PROVIDES_SOCKET_API 1603 #endif // PROVIDES_SOCKET_API
1609 1604
1610 } // namespace_nacl_io 1605 } // namespace_nacl_io
OLDNEW
« no previous file with comments | « native_client_sdk/src/AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698