From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 0004B3857811 for ; Tue, 22 Jun 2021 04:03:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0004B3857811 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-248-teYN9n5UNg-7y9MuuqxxvQ-1; Tue, 22 Jun 2021 00:03:36 -0400 X-MC-Unique: teYN9n5UNg-7y9MuuqxxvQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4E17B1835AC3; Tue, 22 Jun 2021 04:03:35 +0000 (UTC) Received: from greed.delorie.com (ovpn-112-111.rdu2.redhat.com [10.10.112.111]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 221E760871; Tue, 22 Jun 2021 04:03:35 +0000 (UTC) Received: from greed.delorie.com.redhat.com (localhost [127.0.0.1]) by greed.delorie.com (8.15.2/8.15.2) with ESMTP id 15M43Ywr408730; Tue, 22 Jun 2021 00:03:34 -0400 From: DJ Delorie To: Siddhesh Poyarekar Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 5/6] Handle DT_UNKNOWN in gconv-modules.d In-Reply-To: <20210610111853.2286873-6-siddhesh@sourceware.org> Date: Tue, 22 Jun 2021 00:03:34 -0400 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-14.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable 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: Tue, 22 Jun 2021 04:03:39 -0000 Siddhesh Poyarekar writes: > 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 Ok. > /* 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; Ok. > @@ -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; Skip non-regular files that weren't reported earlier (or other errors); ok. LGTM Reviewed-by: DJ Delorie