From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1702347-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id ED45E1580FD for <garchives@archives.gentoo.org>; Sun, 22 Dec 2024 03:49:07 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4A0A6E0940; Sun, 22 Dec 2024 03:49:06 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C2BB3E0940 for <gentoo-commits@lists.gentoo.org>; Sun, 22 Dec 2024 03:49:04 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7B26033C1EB for <gentoo-commits@lists.gentoo.org>; Sun, 22 Dec 2024 03:49:03 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0647E1C6A for <gentoo-commits@lists.gentoo.org>; Sun, 22 Dec 2024 03:49:02 +0000 (UTC) From: "Mike Gilbert" <floppym@gentoo.org> 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 Gilbert" <floppym@gentoo.org> Message-ID: <1734839005.6b34ab545c41e72024402a082eca52379c36035f.floppym@gentoo> Subject: [gentoo-commits] proj/sandbox:stable-2.x commit in: libsandbox/ X-VCS-Repository: proj/sandbox X-VCS-Files: libsandbox/libsandbox.c X-VCS-Directories: libsandbox/ X-VCS-Committer: floppym X-VCS-Committer-Name: Mike Gilbert X-VCS-Revision: 6b34ab545c41e72024402a082eca52379c36035f X-VCS-Branch: stable-2.x Date: Sun, 22 Dec 2024 03:49:02 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 7deb535d-c476-4ab2-b567-229328d4388d X-Archives-Hash: ffe44d53536ac040f0279c3fd7bd49a8 commit: 6b34ab545c41e72024402a082eca52379c36035f Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> AuthorDate: Mon Nov 4 21:17:04 2024 +0000 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> CommitDate: Sun Dec 22 03:43:25 2024 +0000 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=6b34ab54 resolve_dirfd_path: avoid appending a trailing / if path is empty Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org> (cherry picked from commit beb84c66b725b52d5152bb25521671b332520cc9) libsandbox/libsandbox.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libsandbox/libsandbox.c b/libsandbox/libsandbox.c index 18e9626..c4bfac8 100644 --- a/libsandbox/libsandbox.c +++ b/libsandbox/libsandbox.c @@ -159,8 +159,9 @@ int resolve_dirfd_path(int dirfd, const char *path, char *resolved_path, free(fd_path); return -1; } - resolved_path[ret] = '/'; - resolved_path[ret + 1] = '\0'; + if (path && path[0]) + resolved_path[ret++] = '/'; + resolved_path[ret] = '\0'; if (path) strcat(resolved_path, path); From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1709207-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id ECE7715813A for <garchives@archives.gentoo.org>; Tue, 14 Jan 2025 04:38:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B3B1AE07EA; Tue, 14 Jan 2025 04:38:23 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8CFCBE07EA for <gentoo-commits@lists.gentoo.org>; Tue, 14 Jan 2025 04:38:23 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9150F33BF41 for <gentoo-commits@lists.gentoo.org>; Tue, 14 Jan 2025 04:38:22 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E6AC020DB for <gentoo-commits@lists.gentoo.org>; Tue, 14 Jan 2025 04:38:20 +0000 (UTC) From: "Mike Gilbert" <floppym@gentoo.org> 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 Gilbert" <floppym@gentoo.org> Message-ID: <1734839005.6b34ab545c41e72024402a082eca52379c36035f.floppym@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: floppym X-VCS-Committer-Name: Mike Gilbert X-VCS-Revision: 6b34ab545c41e72024402a082eca52379c36035f X-VCS-Branch: master Date: Tue, 14 Jan 2025 04:38:20 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 32031b7d-0d84-4f5d-a584-d3885a2cf20a X-Archives-Hash: a07353227ed6abeeaa85ef27afa29754 Message-ID: <20250114043820.IUHN5M9SmVGbOdp9qwetD3h2u72i-O61RrlVD7N2NRA@z> commit: 6b34ab545c41e72024402a082eca52379c36035f Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> AuthorDate: Mon Nov 4 21:17:04 2024 +0000 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> CommitDate: Sun Dec 22 03:43:25 2024 +0000 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=6b34ab54 resolve_dirfd_path: avoid appending a trailing / if path is empty Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org> (cherry picked from commit beb84c66b725b52d5152bb25521671b332520cc9) libsandbox/libsandbox.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libsandbox/libsandbox.c b/libsandbox/libsandbox.c index 18e9626..c4bfac8 100644 --- a/libsandbox/libsandbox.c +++ b/libsandbox/libsandbox.c @@ -159,8 +159,9 @@ int resolve_dirfd_path(int dirfd, const char *path, char *resolved_path, free(fd_path); return -1; } - resolved_path[ret] = '/'; - resolved_path[ret + 1] = '\0'; + if (path && path[0]) + resolved_path[ret++] = '/'; + resolved_path[ret] = '\0'; if (path) strcat(resolved_path, path);