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: 998769 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-97298-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="kGntsDUz"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42x72k1ywyz9sBQ for ; Fri, 16 Nov 2018 17:03:41 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:message-id:from:to:subject; q=dns; s= default; b=cgI1sD41rQFRmU67456+5cwhEnzbf8FV8wPRCopSeiRSkuL19ZdFk SJF9Q3T8buL1+Qg/TYmWxCTfKap2okBXLyB+C4WK8oDthOYGgsiLZTX6uPs4NKe4 wgxtGlaa7YO8OVGn5sFPcc906IUET3D5fFemgcRmyqz8nNdRxWzV/Y= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:message-id:from:to:subject; s=default; bh=h1yyt/htO36BTrjKKhhyCkAps3s=; b=kGntsDUzfwe9pdnZpVWgIBUuAEuy sCzbhBZi7kEy6nIFgttKSIPVr2YB4l0XYunl4qnEGcSKEti3keCgffy/hlHp4smA xvyoNC7bD1gq9p33djZ6HG/7+qazqhRS3DRF0ZCAh66l0FYzfe7+yYXRj0z7SNzl 90NNiCXG6w+XEmM= 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)