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 BC418138334 for ; Wed, 27 Mar 2019 20:37:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A5153E0837; Wed, 27 Mar 2019 20:37:11 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7A130E0837 for ; Wed, 27 Mar 2019 20:37:11 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D9B01335D04 for ; Wed, 27 Mar 2019 20:37:07 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 213AC571 for ; Wed, 27 Mar 2019 20:37:06 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1553718999.5afa37bd046ea35d9c68f43a1a28233bd0dbc7a7.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qgrep.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 5afa37bd046ea35d9c68f43a1a28233bd0dbc7a7 X-VCS-Branch: master Date: Wed, 27 Mar 2019 20:37:06 +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: 58bb352a-1d58-49d3-9573-2368f827df2a X-Archives-Hash: d8f5b1c0c406e1a7acc268b38f6923b3 commit: 5afa37bd046ea35d9c68f43a1a28233bd0dbc7a7 Author: Fabian Groffen gentoo org> AuthorDate: Wed Mar 27 20:36:39 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Wed Mar 27 20:36:39 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=5afa37bd qgrep: squash truncation warning on Solaris Signed-off-by: Fabian Groffen gentoo.org> qgrep.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qgrep.c b/qgrep.c index fdabf9c..a2b6a98 100644 --- a/qgrep.c +++ b/qgrep.c @@ -449,6 +449,7 @@ int qgrep_main(int argc, char **argv) if ((p = strchr(ebuild, '\n')) != NULL) *p = '\0'; if (show_name || (include_atoms != NULL)) { + size_t l; /* cut ".ebuild" */ if (p == NULL) p = ebuild + strlen(ebuild); @@ -460,8 +461,11 @@ int qgrep_main(int argc, char **argv) /* find head of the ebuild basename */ if ((p = strchr(p, '/')) == NULL) continue; - /* find start of the pkg name */ - snprintf(name, sizeof(name), "%s/%s", ebuild, (p+1)); + /* find start of the pkg name, break up in two to + * avoid warning about possible truncation (very + * unlikely) */ + l = snprintf(name, sizeof(name), "%s", ebuild); + snprintf(name + l, sizeof(name) - l, "%s", p); /* restore the filepath */ *p = '/'; *(p + strlen(p)) = '.';