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 ESMTPS id C115D3858D32 for ; Mon, 19 Sep 2022 07:27:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C115D3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663572433; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=kB6LWlaAoH2dJF5NU3G0xfP7/rMAX3TnscOC/qvoCfE=; b=is/JgIhS7Aol7Rb8mdd1qGu0Q9LU1Zv+w8MsRBJn8pt8KONGlHISexhEicmY76Amy6EPNi Dpx5diI/MXLuIILStDAAFNOTqkeTUnwtXPW+7BAi28A+gyvDYr766b4P5s95b654rZLhlC A4Ll9vKRDg6fDybwu9gXrIc2sd0HJ3U= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-206-JAIwbtu6OPmTKumvjui29Q-1; Mon, 19 Sep 2022 03:27:11 -0400 X-MC-Unique: JAIwbtu6OPmTKumvjui29Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1A14B382ECC1; Mon, 19 Sep 2022 07:27:11 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.137]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8068FC15BA4; Mon, 19 Sep 2022 07:27:10 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Cc: Helge Deller Subject: [PATCH] gconv: Use 64-bit interfaces in gconv_parseconfdir (bug 29583) Date: Mon, 19 Sep 2022 09:27:08 +0200 Message-ID: <87czbrj037.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.5 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,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: It's possible that inode numbers are outside the 32-bit range. The existing code only handles the in-libc case correctly, and still uses the legacy interfaces when building iconv. Suggested-by: Helge Deller Tested on i686-linux-gnu and x86_64-linux-gnu. --- iconv/gconv_parseconfdir.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/iconv/gconv_parseconfdir.h b/iconv/gconv_parseconfdir.h index 79398a980c..741cf7c67e 100644 --- a/iconv/gconv_parseconfdir.h +++ b/iconv/gconv_parseconfdir.h @@ -29,14 +29,14 @@ # define isspace(__c) __isspace_l ((__c), _nl_C_locobj_ptr) # define asprintf __asprintf # define opendir __opendir -# define readdir __readdir +# define readdir64 __readdir64 # define closedir __closedir # define mempcpy __mempcpy -# define struct_stat struct __stat64_t64 -# define lstat __lstat64_time64 +# define struct_stat64 struct __stat64_t64 +# define lstat64 __lstat64_time64 # define feof_unlocked __feof_unlocked #else -# define struct_stat struct stat +# define struct_stat64 struct stat64 #endif /* Name of the file containing the module information in the directories @@ -148,8 +148,8 @@ gconv_parseconfdir (const char *prefix, const char *dir, size_t dir_len) DIR *confdir = opendir (buf); if (confdir != NULL) { - struct dirent *ent; - while ((ent = readdir (confdir)) != NULL) + struct dirent64 *ent; + while ((ent = readdir64 (confdir)) != NULL) { if (ent->d_type != DT_REG && ent->d_type != DT_UNKNOWN) continue; @@ -161,12 +161,12 @@ gconv_parseconfdir (const char *prefix, const char *dir, size_t dir_len) && strcmp (ent->d_name + len - strlen (suffix), suffix) == 0) { char *conf; - struct_stat st; + struct_stat64 st; if (asprintf (&conf, "%s/%s", buf, ent->d_name) < 0) continue; if (ent->d_type != DT_UNKNOWN - || (lstat (conf, &st) != -1 && S_ISREG (st.st_mode))) + || (lstat64 (conf, &st) != -1 && S_ISREG (st.st_mode))) found |= read_conf_file (conf, dir, dir_len); free (conf); base-commit: 300946f0506e9cf12f16fc11eeea36c24cde7c82