1 |
commit: baf15c305c8687d1573c7accc12a62f29384259c |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Oct 18 22:03:57 2021 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Oct 18 22:03:57 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=baf15c30 |
7 |
|
8 |
libsandbox: fix incorrect indentation |
9 |
|
10 |
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org> |
11 |
|
12 |
libsandbox/libsandbox.c | 17 +++++++++-------- |
13 |
1 file changed, 9 insertions(+), 8 deletions(-) |
14 |
|
15 |
diff --git a/libsandbox/libsandbox.c b/libsandbox/libsandbox.c |
16 |
index 02f5ef2..d69fecd 100644 |
17 |
--- a/libsandbox/libsandbox.c |
18 |
+++ b/libsandbox/libsandbox.c |
19 |
@@ -132,14 +132,15 @@ int resolve_dirfd_path(int dirfd, const char *path, char *resolved_path, |
20 |
save_errno(); |
21 |
|
22 |
size_t at_len = resolved_path_len - 1 - 1 - (path ? strlen(path) : 0); |
23 |
- if (trace_pid) |
24 |
- sprintf(resolved_path, "/proc/%i/fd/%i", trace_pid, dirfd); |
25 |
- else |
26 |
- /* If /proc was mounted by a process in a different pid namespace, |
27 |
- * getpid cannot be used to create a valid /proc/<pid> path. Instead |
28 |
- * use sb_get_fd_dir() which works in any case. |
29 |
- */ |
30 |
- sprintf(resolved_path, "%s/%i", sb_get_fd_dir(), dirfd); |
31 |
+ if (trace_pid) { |
32 |
+ sprintf(resolved_path, "/proc/%i/fd/%i", trace_pid, dirfd); |
33 |
+ } else { |
34 |
+ /* If /proc was mounted by a process in a different pid namespace, |
35 |
+ * getpid cannot be used to create a valid /proc/<pid> path. Instead |
36 |
+ * use sb_get_fd_dir() which works in any case. |
37 |
+ */ |
38 |
+ sprintf(resolved_path, "%s/%i", sb_get_fd_dir(), dirfd); |
39 |
+ } |
40 |
ssize_t ret = readlink(resolved_path, resolved_path, at_len); |
41 |
if (ret == -1) { |
42 |
/* see comments at end of check_syscall() */ |