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 63D191382C5 for ; Fri, 23 Mar 2018 13:17:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 38DB2E088F; Fri, 23 Mar 2018 13:17:08 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 F08D7E088F for ; Fri, 23 Mar 2018 13:17:07 +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 51A7A335C36 for ; Fri, 23 Mar 2018 13:17:05 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3E3E8264 for ; Fri, 23 Mar 2018 13:17:03 +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: <1521810991.bf111d7d5464f8a6b3a251d3d12fe9e39357bc6e.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: main.c qcheck.c qdepends.c qgrep.c qlop.c qsearch.c qsize.c qxpak.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: bf111d7d5464f8a6b3a251d3d12fe9e39357bc6e X-VCS-Branch: master Date: Fri, 23 Mar 2018 13:17:03 +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-Archives-Salt: 25feb457-67a6-45f1-82aa-8c227a054551 X-Archives-Hash: 82112246ec09476956b081458b2ca8b1 commit: bf111d7d5464f8a6b3a251d3d12fe9e39357bc6e Author: Fabian Groffen gentoo org> AuthorDate: Fri Mar 23 13:16:31 2018 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Fri Mar 23 13:16:31 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=bf111d7d fix signedness warnings main.c | 8 +++++--- qcheck.c | 2 +- qdepends.c | 2 +- qgrep.c | 5 +++-- qlop.c | 7 ++++--- qsearch.c | 2 +- qsize.c | 2 +- qxpak.c | 8 +++++--- 8 files changed, 21 insertions(+), 15 deletions(-) diff --git a/main.c b/main.c index b11fe83..44226db 100644 --- a/main.c +++ b/main.c @@ -1420,9 +1420,11 @@ get_vdb_atoms(int fullcpv) if ((dfd = scandirat(ctx->vdb_fd, cat[j]->d_name, &pf, q_vdb_filter_pkg, alphasort)) < 0) continue; for (i = 0; i < dfd; i++) { - int blen = snprintf(buf, sizeof(buf), "%s/%s/SLOT", cat[j]->d_name, pf[i]->d_name); - if (blen >= sizeof(buf)) { - warnf("unable to parse long package: %s/%s", cat[j]->d_name, pf[i]->d_name); + int blen = snprintf(buf, sizeof(buf), "%s/%s/SLOT", + cat[j]->d_name, pf[i]->d_name); + if (blen < 0 || (size_t)blen >= sizeof(buf)) { + warnf("unable to parse long package: %s/%s", + cat[j]->d_name, pf[i]->d_name); continue; } diff --git a/qcheck.c b/qcheck.c index 26b820e..66589a3 100644 --- a/qcheck.c +++ b/qcheck.c @@ -375,7 +375,7 @@ int qcheck_main(int argc, char **argv) argc -= optind; argv += optind; - for (i = 0; i < argc; ++i) { + for (i = 0; i < (size_t)argc; ++i) { atom = atom_explode(argv[i]); if (!atom) warn("invalid atom: %s", argv[i]); diff --git a/qdepends.c b/qdepends.c index a614704..e8b2190 100644 --- a/qdepends.c +++ b/qdepends.c @@ -579,7 +579,7 @@ int qdepends_main(int argc, char **argv) else { cb = qdepends_main_vdb_cb; - for (i = 0; i < argc; ++i) { + for (i = 0; i < (size_t)argc; ++i) { atom = atom_explode(argv[i]); if (!atom) warn("invalid atom: %s", argv[i]); diff --git a/qgrep.c b/qgrep.c index 0680035..fe53ea2 100644 --- a/qgrep.c +++ b/qgrep.c @@ -153,9 +153,10 @@ qgrep_print_line(qgrep_buf_t *current, const char *label, int regexec_flags = 0; while ((*p != '\0') && !regexec(preg, p, 1, &match, regexec_flags)) { if (match.rm_so > 0) - printf("%.*s", match.rm_so, p); + printf("%.*s", (int)match.rm_so, p); if (match.rm_eo > match.rm_so) { - printf("%s%.*s%s", RED, match.rm_eo - match.rm_so, p + match.rm_so, NORM); + printf("%s%.*s%s", RED, (int)(match.rm_eo - match.rm_so), + p + match.rm_so, NORM); p += match.rm_eo; } else { p += match.rm_eo; diff --git a/qlop.c b/qlop.c index 5be2ddd..410a94b 100644 --- a/qlop.c +++ b/qlop.c @@ -580,7 +580,8 @@ void show_current_emerge(void) raip = realloc(ip, sizeof(struct kinfo_proc) * size); if (raip == NULL) { free(ip); - warnp("Could not extend allocated block to %d bytes for process information", + warnp("Could not extend allocated block to " + "%zd bytes for process information", sizeof(struct kinfo_proc) * size); return; } @@ -798,7 +799,7 @@ int qlop_main(int argc, char **argv) argc -= optind; argv += optind; - for (i = 0; i < argc; ++i) { + for (i = 0; i < (size_t)argc; ++i) { atom = atom_explode(argv[i]); if (!atom) warn("invalid atom: %s", argv[i]); @@ -820,7 +821,7 @@ int qlop_main(int argc, char **argv) show_sync_history(logfile, start_time, end_time); if (do_time) { - for (i = 0; i < argc; ++i) + for (i = 0; i < (size_t)argc; ++i) show_merge_times(argv[i], logfile, average, do_human_readable, start_time, end_time); } diff --git a/qsearch.c b/qsearch.c index c2b2ebe..a620f95 100644 --- a/qsearch.c +++ b/qsearch.c @@ -104,7 +104,7 @@ qsearch_ebuild_ebuild(int overlay_fd, const char *ebuild, const char *search_me, int linelen; size_t buflen; while ((linelen = getline(&buf, &buflen, ebuildfp)) >= 0) { - if (linelen <= search_len) + if ((size_t)linelen <= search_len) continue; if (strncmp(buf, search_var, search_len) != 0) continue; diff --git a/qsize.c b/qsize.c index b92f533..acf74bf 100644 --- a/qsize.c +++ b/qsize.c @@ -176,7 +176,7 @@ int qsize_main(int argc, char **argv) argc -= optind; argv += optind; - for (i = 0; i < argc; ++i) { + for (i = 0; i < (size_t)argc; ++i) { atom = atom_explode(argv[i]); if (!atom) warn("invalid atom: %s", argv[i]); diff --git a/qxpak.c b/qxpak.c index 95fb779..ada9767 100644 --- a/qxpak.c +++ b/qxpak.c @@ -341,9 +341,11 @@ xpak_create(int dir_fd, const char *file, int argc, char **argv) if ((numfiles = scandir(argv[i], &dir, filter_hidden, alphasort)) < 0) warn("Directory '%s' is empty; skipping", argv[i]); for (fidx = 0; fidx < numfiles; ++fidx) { - int ret = snprintf(path, sizeof(path), "%s/%s", argv[i], dir[fidx]->d_name); - if (ret >= sizeof(path)) { - warn("skipping path too long: %s/%s", argv[i], dir[fidx]->d_name); + int ret = snprintf(path, sizeof(path), "%s/%s", + argv[i], dir[fidx]->d_name); + if (ret < 0 || (size_t)ret >= sizeof(path)) { + warn("skipping path too long: %s/%s", + argv[i], dir[fidx]->d_name); continue; } if (stat(path, &st) < 0) {