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

Side by Side Diff: fusl/src/unistd/getcwd.c

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 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
OLDNEW
1 #include <unistd.h> 1 #include <unistd.h>
2 #include <errno.h> 2 #include <errno.h>
3 #include <limits.h> 3 #include <limits.h>
4 #include <string.h> 4 #include <string.h>
5 #include "syscall.h" 5 #include "syscall.h"
6 6
7 char *getcwd(char *buf, size_t size) 7 char* getcwd(char* buf, size_t size) {
8 { 8 char tmp[PATH_MAX];
9 » char tmp[PATH_MAX]; 9 if (!buf) {
10 » if (!buf) { 10 buf = tmp;
11 » » buf = tmp; 11 size = PATH_MAX;
12 » » size = PATH_MAX; 12 } else if (!size) {
13 » } else if (!size) { 13 errno = EINVAL;
14 » » errno = EINVAL; 14 return 0;
15 » » return 0; 15 }
16 » } 16 if (syscall(SYS_getcwd, buf, size) < 0)
17 » if (syscall(SYS_getcwd, buf, size) < 0) return 0; 17 return 0;
18 » return buf == tmp ? strdup(buf) : buf; 18 return buf == tmp ? strdup(buf) : buf;
19 } 19 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698