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

Side by Side Diff: fusl/src/stdio/tmpnam.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 <stdio.h> 1 #include <stdio.h>
2 #include <fcntl.h> 2 #include <fcntl.h>
3 #include <errno.h> 3 #include <errno.h>
4 #include <sys/stat.h> 4 #include <sys/stat.h>
5 #include <string.h> 5 #include <string.h>
6 #include "syscall.h" 6 #include "syscall.h"
7 7
8 #define MAXTRIES 100 8 #define MAXTRIES 100
9 9
10 char *__randname(char *); 10 char* __randname(char*);
11 11
12 char *tmpnam(char *buf) 12 char* tmpnam(char* buf) {
13 { 13 static char internal[L_tmpnam];
14 » static char internal[L_tmpnam]; 14 char s[] = "/tmp/tmpnam_XXXXXX";
15 » char s[] = "/tmp/tmpnam_XXXXXX"; 15 int try
16 » int try; 16 ;
17 » int r; 17 int r;
18 » for (try=0; try<MAXTRIES; try++) { 18 for (try = 0; try < MAXTRIES; try ++) {
19 » » __randname(s+12); 19 __randname(s + 12);
20 #ifdef SYS_lstat 20 #ifdef SYS_lstat
21 » » r = __syscall(SYS_lstat, s, &(struct stat){0}); 21 r = __syscall(SYS_lstat, s, &(struct stat){0});
22 #else 22 #else
23 » » r = __syscall(SYS_fstatat, AT_FDCWD, s, 23 r = __syscall(SYS_fstatat, AT_FDCWD, s, &(struct stat){0},
24 » » » &(struct stat){0}, AT_SYMLINK_NOFOLLOW); 24 AT_SYMLINK_NOFOLLOW);
25 #endif 25 #endif
26 » » if (r == -ENOENT) return strcpy(buf ? buf : internal, s); 26 if (r == -ENOENT)
27 » } 27 return strcpy(buf ? buf : internal, s);
28 » return 0; 28 }
29 return 0;
29 } 30 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698