From patchwork Fri Nov 16 06:03:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 30161 Received: (qmail 51070 invoked by alias); 16 Nov 2018 06:03:34 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 51055 invoked by uid 89); 16 Nov 2018 06:03:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=UD:php X-HELO: mx1.redhat.com Date: Fri, 16 Nov 2018 01:03:29 -0500 Message-Id: From: DJ Delorie To: libc-alpha@sourceware.org Subject: swbz #23501 - define stat buffer for FTW_SLN case http://austingroupbugs.net/view.php?id=1121 https://sourceware.org/bugzilla/show_bug.cgi?id=23501 Tested with no regressions. * io/ftw.c (process_entry): Define the stat buf in the case of dangling symlinks, despite FTW_PHYS flag. diff --git a/io/ftw.c b/io/ftw.c index f6ecbe7d90..ac2e38333b 100644 --- a/io/ftw.c +++ b/io/ftw.c @@ -424,7 +424,19 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name, else if (data->flags & FTW_PHYS) flag = FTW_NS; else if (d_type == DT_LNK) - flag = FTW_SLN; + { + flag = FTW_SLN; + + /* We don't care about any errors that occur here. Old code + left ST undefined; a clarification at the ISO level + defines it for this case, and filling in ST is all we + need, so this is only "best effort". */ + if (dir->streamfd != -1) + FXSTATAT (_STAT_VER, dir->streamfd, name, &st, + AT_SYMLINK_NOFOLLOW); + else + LXSTAT (_STAT_VER, name, &st); + } else { if (dir->streamfd != -1)