From patchwork Thu Jun 10 11:18:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 43819 X-Patchwork-Delegate: dj@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 14B6C398A41A for ; Thu, 10 Jun 2021 11:23:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14B6C398A41A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1623324233; bh=xN0JoeyrGOoZJ4k/lExlydKRFv7cpTdDQ8NlBI+oDmo=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=SskJcbQbO117gTy94ceb3V8Kz7NoBoLNnubrw2Rhq2hrEJ8puPD9QvE5aVXwmadxB bVDiANXNp7bqc6ZPyo5KaWgDOgMAKSTJ60Xe7vXKltKnQjL1k5wGnD730SQGxymdhS 4Y+brS3psSfzabEd+uYTHNCw9wLpfC/zQCShLxrQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from crocodile.elm.relay.mailchannels.net (crocodile.elm.relay.mailchannels.net [23.83.212.45]) by sourceware.org (Postfix) with ESMTPS id 56D20399E040 for ; Thu, 10 Jun 2021 11:20:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 56D20399E040 X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id CEA974026C5; Thu, 10 Jun 2021 11:20:00 +0000 (UTC) Received: from pdx1-sub0-mail-a13.g.dreamhost.com (100-98-55-29.trex.outbound.svc.cluster.local [100.98.55.29]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 40D4A402B99; Thu, 10 Jun 2021 11:20:00 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a13.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.98.55.29 (trex/6.3.1); Thu, 10 Jun 2021 11:20:00 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Lonely-Little: 6f16b5573a0d8f16_1623324000628_4019447868 X-MC-Loop-Signature: 1623324000628:3843803844 X-MC-Ingress-Time: 1623324000627 Received: from pdx1-sub0-mail-a13.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a13.g.dreamhost.com (Postfix) with ESMTP id EF62E800C5; Thu, 10 Jun 2021 11:19:59 +0000 (UTC) Received: from rhbox.intra.reserved-bit.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a13.g.dreamhost.com (Postfix) with ESMTPSA id 0C67E7FF19; Thu, 10 Jun 2021 11:19:56 +0000 (UTC) X-DH-BACKEND: pdx1-sub0-mail-a13 To: libc-alpha@sourceware.org Subject: [PATCH 5/6] Handle DT_UNKNOWN in gconv-modules.d Date: Thu, 10 Jun 2021 16:48:52 +0530 Message-Id: <20210610111853.2286873-6-siddhesh@sourceware.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610111853.2286873-1-siddhesh@sourceware.org> References: <20210610111853.2286873-1-siddhesh@sourceware.org> MIME-Version: 1.0 X-Spam-Status: No, score=-3494.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Siddhesh Poyarekar via Libc-alpha From: Siddhesh Poyarekar Reply-To: Siddhesh Poyarekar Cc: schwab@linux-m68k.org Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" On filesystems that do not support dt_type, a regular file shows up as DT_UNKNOWN. Fall back to using lstat64 to read file properties in such cases. Reviewed-by: DJ Delorie --- iconv/gconv_parseconfdir.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/iconv/gconv_parseconfdir.h b/iconv/gconv_parseconfdir.h index 3d4d58d4be..e73ea0ff5c 100644 --- a/iconv/gconv_parseconfdir.h +++ b/iconv/gconv_parseconfdir.h @@ -32,6 +32,7 @@ # define readdir __readdir # define closedir __closedir # define mempcpy __mempcpy +# define lstat64 __lstat64 #endif /* Name of the file containing the module information in the directories @@ -138,7 +139,7 @@ gconv_parseconfdir (const char *dir, size_t dir_len) struct dirent *ent; while ((ent = readdir (confdir)) != NULL) { - if (ent->d_type != DT_REG) + if (ent->d_type != DT_REG && ent->d_type != DT_UNKNOWN) continue; size_t len = strlen (ent->d_name); @@ -148,8 +149,14 @@ gconv_parseconfdir (const char *dir, size_t dir_len) && strcmp (ent->d_name + len - strlen (suffix), suffix) == 0) { char *conf; + struct stat64 st; if (asprintf (&conf, "%s/%s", buf, ent->d_name) < 0) continue; + if (ent->d_type == DT_UNKNOWN + && (lstat64 (conf, &st) == -1 + || !S_ISREG (st.st_mode))) + continue; + found |= read_conf_file (conf, dir, dir_len); free (conf); }