From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id BEE1E158086 for ; Mon, 18 Oct 2021 22:04:23 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E9D99E0831; Mon, 18 Oct 2021 22:04:22 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D0B59E0831 for ; Mon, 18 Oct 2021 22:04:22 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D97473436A1 for ; Mon, 18 Oct 2021 22:04:21 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0A23E8E for ; Mon, 18 Oct 2021 22:04:20 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1634594637.baf15c305c8687d1573c7accc12a62f29384259c.vapier@gentoo> Subject: [gentoo-commits] proj/sandbox:master commit in: libsandbox/ X-VCS-Repository: proj/sandbox X-VCS-Files: libsandbox/libsandbox.c X-VCS-Directories: libsandbox/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: baf15c305c8687d1573c7accc12a62f29384259c X-VCS-Branch: master Date: Mon, 18 Oct 2021 22:04:20 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: dd2fb2c2-22dd-45c2-a3a8-e9a8b4b34b36 X-Archives-Hash: 6e4d736c5963a50d6fced75b995747b2 commit: baf15c305c8687d1573c7accc12a62f29384259c Author: Mike Frysinger gentoo org> AuthorDate: Mon Oct 18 22:03:57 2021 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Mon Oct 18 22:03:57 2021 +0000 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=baf15c30 libsandbox: fix incorrect indentation Signed-off-by: Mike Frysinger gentoo.org> libsandbox/libsandbox.c | 17 +++++++++-------- 1 file 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/ 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/ 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() */