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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 80EEE15800F for ; Tue, 24 Jan 2023 03:05:56 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7087FE07B2; Tue, 24 Jan 2023 03:05:55 +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)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 52660E07B2 for ; Tue, 24 Jan 2023 03:05:55 +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 2A2E7335D88 for ; Tue, 24 Jan 2023 03:05:54 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 97F14865 for ; Tue, 24 Jan 2023 03:05:51 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1674529403.09f9b61bdfa488d78bdba4562eb208bd1f062eaf.sam@gentoo> Subject: [gentoo-commits] proj/elfix:master commit in: misc/install-xattr/ X-VCS-Repository: proj/elfix X-VCS-Files: misc/install-xattr/install-xattr.c X-VCS-Directories: misc/install-xattr/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 09f9b61bdfa488d78bdba4562eb208bd1f062eaf X-VCS-Branch: master Date: Tue, 24 Jan 2023 03:05:51 +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: 95d7c3b6-4d78-4606-bdc5-ddfe61da0d25 X-Archives-Hash: 4ec43d5fb4e6644de51345da0ecd4c10 commit: 09f9b61bdfa488d78bdba4562eb208bd1f062eaf Author: Sam James gentoo org> AuthorDate: Tue Jan 24 02:45:11 2023 +0000 Commit: Sam James gentoo org> CommitDate: Tue Jan 24 03:03:23 2023 +0000 URL: https://gitweb.gentoo.org/proj/elfix.git/commit/?id=09f9b61b install-xattr: fix chdir arg when OLDPWD is nulL Fix core.NonNullParamChecker with chdir(). Clang's scan-build says: ``` install-xattr.c:331:9: warning: Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker] if (chdir(oldpwd) != 0) ^~~~~~~~~~~~~ ``` It's right - oldpwd could easily have been null: ``` $ env -u OLDPWD __PORTAGE_HELPER_PATH=foo ./install-xattr --version ``` Signed-off-by: Sam James gentoo.org> misc/install-xattr/install-xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/install-xattr/install-xattr.c b/misc/install-xattr/install-xattr.c index 2966af4..33b9fe1 100644 --- a/misc/install-xattr/install-xattr.c +++ b/misc/install-xattr/install-xattr.c @@ -345,7 +345,7 @@ main(int argc, char* argv[]) char *portage_helper_path = getenv("__PORTAGE_HELPER_PATH"); char *portage_helper_canpath = NULL; if (portage_helper_path) - if (chdir(oldpwd) != 0) + if (!oldpwd || chdir(oldpwd) != 0) err(1, "failed to chdir %s", oldpwd); switch (fork()) {