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 01697138334 for ; Thu, 25 Apr 2019 09:22:17 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 98DC7E094B; Thu, 25 Apr 2019 09:22:15 +0000 (UTC) Received: from smtp.gentoo.org (dev.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 80BBCE094B for ; Thu, 25 Apr 2019 09:22:15 +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 BD1ED34264F for ; Thu, 25 Apr 2019 09:22:13 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 2F1E65CC for ; Thu, 25 Apr 2019 09:22:12 +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: <1556008881.95c95c9840129ec9d32be0bddda924f4426481b0.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/ X-VCS-Repository: proj/portage-utils X-VCS-Files: libq/vdb.c libq/vdb.h X-VCS-Directories: libq/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 95c95c9840129ec9d32be0bddda924f4426481b0 X-VCS-Branch: master Date: Thu, 25 Apr 2019 09:22:12 +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: 94d945c8-d3ec-4c99-a1ca-0850e2a74086 X-Archives-Hash: 1d8beedd9f352c66e95697627a4fbbb8 commit: 95c95c9840129ec9d32be0bddda924f4426481b0 Author: Fabian Groffen gentoo org> AuthorDate: Tue Apr 23 08:41:21 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Tue Apr 23 08:41:21 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=95c95c98 q_vdb_open2: introduce version that is optionally quiet For probing, it may be nice not to emit a warning for each probe. Signed-off-by: Fabian Groffen gentoo.org> libq/vdb.c | 14 +++++++++++--- libq/vdb.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libq/vdb.c b/libq/vdb.c index 6b973e8..a32ba53 100644 --- a/libq/vdb.c +++ b/libq/vdb.c @@ -18,13 +18,14 @@ #include q_vdb_ctx * -q_vdb_open(const char *sroot, const char *svdb) +q_vdb_open2(const char *sroot, const char *svdb, bool quiet) { q_vdb_ctx *ctx = xmalloc(sizeof(*ctx)); ctx->portroot_fd = open(sroot, O_RDONLY|O_CLOEXEC|O_PATH); if (ctx->portroot_fd == -1) { - warnp("could not open root: %s", sroot); + if (!quiet) + warnp("could not open root: %s", sroot); goto f_error; } @@ -35,7 +36,8 @@ q_vdb_open(const char *sroot, const char *svdb) /* Cannot use O_PATH as we want to use fdopendir() */ ctx->vdb_fd = openat(ctx->portroot_fd, svdb, O_RDONLY|O_CLOEXEC); if (ctx->vdb_fd == -1) { - warnp("could not open vdb: %s (in root %s)", svdb, sroot); + if (!quiet) + warnp("could not open vdb: %s (in root %s)", svdb, sroot); goto cp_error; } @@ -54,6 +56,12 @@ q_vdb_open(const char *sroot, const char *svdb) return NULL; } +q_vdb_ctx * +q_vdb_open(const char *sroot, const char *svdb) +{ + return q_vdb_open2(sroot, svdb, false); +} + void q_vdb_close(q_vdb_ctx *ctx) { diff --git a/libq/vdb.h b/libq/vdb.h index 80c318c..102f5a9 100644 --- a/libq/vdb.h +++ b/libq/vdb.h @@ -38,6 +38,7 @@ typedef int (q_vdb_pkg_cb)(q_vdb_pkg_ctx *, void *priv); typedef int (q_vdb_cat_filter)(q_vdb_cat_ctx *, void *priv); q_vdb_ctx *q_vdb_open(const char *sroot, const char *svdb); +q_vdb_ctx *q_vdb_open2(const char *sroot, const char *svdb, bool quiet); void q_vdb_close(q_vdb_ctx *ctx); int q_vdb_filter_cat(const struct dirent *de); q_vdb_cat_ctx *q_vdb_open_cat(q_vdb_ctx *ctx, const char *name);