From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Cc: adhemerval.zanella@linaro.org, dj@redhat.com, schwab@linux-m68k.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 Content-Transfer-Encoding: quoted-printable 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-List-Received-Date: Thu, 10 Jun 2021 11:20:05 -0000 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. --- 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 =20 /* 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 =3D readdir (confdir)) !=3D NULL) { - if (ent->d_type !=3D DT_REG) + if (ent->d_type !=3D DT_REG && ent->d_type !=3D DT_UNKNOWN) continue; =20 size_t len =3D 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) =3D=3D 0) { char *conf; + struct stat64 st; if (asprintf (&conf, "%s/%s", buf, ent->d_name) < 0) continue; + if (ent->d_type =3D=3D DT_UNKNOWN + && (lstat64 (conf, &st) =3D=3D -1 + || !S_ISREG (st.st_mode))) + continue; + found |=3D read_conf_file (conf, dir, dir_len); free (conf); } --=20 2.31.1