aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-10-18 18:03:57 -0400
committerMike Frysinger <vapier@gentoo.org>2021-10-18 18:03:57 -0400
commitbaf15c305c8687d1573c7accc12a62f29384259c (patch)
treef44cd9216f35105dc0ae63c9eeac7214a26c4b5b /libsandbox
parentlibsandbox: add SANDBOX_METHOD setting (diff)
downloadsandbox-baf15c305c8687d1573c7accc12a62f29384259c.tar.gz
sandbox-baf15c305c8687d1573c7accc12a62f29384259c.tar.bz2
sandbox-baf15c305c8687d1573c7accc12a62f29384259c.zip
libsandbox: fix incorrect indentation
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsandbox')
-rw-r--r--libsandbox/libsandbox.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libsandbox/libsandbox.c b/libsandbox/libsandbox.c
index 02f5ef2..d69fecd 100644
--- a/libsandbox/libsandbox.c
+++ b/libsandbox/libsandbox.c
@@ -132,14 +132,15 @@ int resolve_dirfd_path(int dirfd, const char *path, char *resolved_path,
save_errno();
size_t at_len = resolved_path_len - 1 - 1 - (path ? strlen(path) : 0);
- if (trace_pid)
- sprintf(resolved_path, "/proc/%i/fd/%i", trace_pid, dirfd);
- else
- /* If /proc was mounted by a process in a different pid namespace,
- * getpid cannot be used to create a valid /proc/<pid> path. Instead
- * use sb_get_fd_dir() which works in any case.
- */
- sprintf(resolved_path, "%s/%i", sb_get_fd_dir(), dirfd);
+ if (trace_pid) {
+ sprintf(resolved_path, "/proc/%i/fd/%i", trace_pid, dirfd);
+ } else {
+ /* If /proc was mounted by a process in a different pid namespace,
+ * getpid cannot be used to create a valid /proc/<pid> path. Instead
+ * use sb_get_fd_dir() which works in any case.
+ */
+ sprintf(resolved_path, "%s/%i", sb_get_fd_dir(), dirfd);
+ }
ssize_t ret = readlink(resolved_path, resolved_path, at_len);
if (ret == -1) {
/* see comments at end of check_syscall() */