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

Side by Side Diff: fusl/src/stat/fchmodat.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 <sys/stat.h> 1 #include <sys/stat.h>
2 #include <fcntl.h> 2 #include <fcntl.h>
3 #include <errno.h> 3 #include <errno.h>
4 #include "syscall.h" 4 #include "syscall.h"
5 5
6 void __procfdname(char *, unsigned); 6 void __procfdname(char*, unsigned);
7 7
8 int fchmodat(int fd, const char *path, mode_t mode, int flag) 8 int fchmodat(int fd, const char* path, mode_t mode, int flag) {
9 { 9 if (!flag)
10 » if (!flag) return syscall(SYS_fchmodat, fd, path, mode, flag); 10 return syscall(SYS_fchmodat, fd, path, mode, flag);
11 11
12 » if (flag != AT_SYMLINK_NOFOLLOW) 12 if (flag != AT_SYMLINK_NOFOLLOW)
13 » » return __syscall_ret(-EINVAL); 13 return __syscall_ret(-EINVAL);
14 14
15 » struct stat st; 15 struct stat st;
16 » int ret, fd2; 16 int ret, fd2;
17 » char proc[15+3*sizeof(int)]; 17 char proc[15 + 3 * sizeof(int)];
18 18
19 » if ((ret = __syscall(SYS_fstatat, fd, path, &st, flag))) 19 if ((ret = __syscall(SYS_fstatat, fd, path, &st, flag)))
20 » » return __syscall_ret(ret); 20 return __syscall_ret(ret);
21 » if (S_ISLNK(st.st_mode)) 21 if (S_ISLNK(st.st_mode))
22 » » return __syscall_ret(-EOPNOTSUPP); 22 return __syscall_ret(-EOPNOTSUPP);
23 23
24 » if ((fd2 = __syscall(SYS_openat, fd, path, O_RDONLY|O_PATH|O_NOFOLLOW|O_ NOCTTY|O_CLOEXEC)) < 0) { 24 if ((fd2 = __syscall(SYS_openat, fd, path, O_RDONLY | O_PATH | O_NOFOLLOW |
25 » » if (fd2 == -ELOOP) 25 O_NOCTTY | O_CLOEXEC)) < 0) {
26 » » » return __syscall_ret(-EOPNOTSUPP); 26 if (fd2 == -ELOOP)
27 » » return __syscall_ret(fd2); 27 return __syscall_ret(-EOPNOTSUPP);
28 » } 28 return __syscall_ret(fd2);
29 }
29 30
30 » __procfdname(proc, fd2); 31 __procfdname(proc, fd2);
31 » ret = __syscall(SYS_fstatat, AT_FDCWD, proc, &st, 0); 32 ret = __syscall(SYS_fstatat, AT_FDCWD, proc, &st, 0);
32 » if (!ret) { 33 if (!ret) {
33 » » if (S_ISLNK(st.st_mode)) ret = -EOPNOTSUPP; 34 if (S_ISLNK(st.st_mode))
34 » » else ret = __syscall(SYS_fchmodat, AT_FDCWD, proc, mode); 35 ret = -EOPNOTSUPP;
35 » } 36 else
37 ret = __syscall(SYS_fchmodat, AT_FDCWD, proc, mode);
38 }
36 39
37 » __syscall(SYS_close, fd2); 40 __syscall(SYS_close, fd2);
38 » return __syscall_ret(ret); 41 return __syscall_ret(ret);
39 } 42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698