From patchwork Tue Oct 2 11:08:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gerald Pfeifer X-Patchwork-Id: 977715 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=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-486774-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pfeifer.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="gK68Ebvo"; 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 42Pbxq6BQ5z9sj9 for ; Tue, 2 Oct 2018 21:09:02 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=nW0LCu2LoosvuQxgOFOGz9MjHETdFqvOwl8iA/5LoP2rMAAYNqtNB et2To/tq6R6VUgxwrKDHurvl6iWmzD4j9Tg2Rodik0ybZjsR9hXjSPAuWuz3kc2+ zKSyi4nG1O+eauuv7bJ+OUZBfs4N3a4scGSzKPXN3h7EZu+gPuLqoc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=jB0YlEFoLWDV6BKUDe6WjftpYRs=; b=gK68EbvoQFBfOXZqUWuG iGmVOyh5w9/gRqJYT3zPb82sXK2g6w/28Z9pqFicAJC06y0p3E5G/uUOUrlQfyOG F/tAYuoWJ8Bk/NKfrq+1PuVrP1RpI9CiInGg5LrJ7AhkhrnxVnIGDC4W2LlkdTiz cT+nWc/X8PWzv94OSGpsypE= Received: (qmail 127981 invoked by alias); 2 Oct 2018 11:08:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 127957 invoked by uid 89); 2 Oct 2018 11:08:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=HTo:U*jb, H*Ad:U*jb, H*Ad:U*fortran, HTo:U*fortran X-HELO: ainaz.pair.com Received: from ainaz.pair.com (HELO ainaz.pair.com) (209.68.2.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 02 Oct 2018 11:08:49 +0000 Received: from ainaz.pair.com (localhost [127.0.0.1]) by ainaz.pair.com (Postfix) with ESMTP id B5668B53EDB; Tue, 2 Oct 2018 07:08:47 -0400 (EDT) Received: from anthias (ip-109-40-129-89.web.vodafone.de [109.40.129.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ainaz.pair.com (Postfix) with ESMTPSA id 8F854B53EDA; Tue, 2 Oct 2018 07:08:46 -0400 (EDT) Date: Tue, 2 Oct 2018 13:08:42 +0200 (CEST) From: Gerald Pfeifer To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org, Janne Blomqvist Subject: [PATCH, Fortran] Fix libgfortran/io/close.c for !HAVE_UNLINK_OPEN_FILE Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Revision r215307 | jb | 2014-09-16 23:40:28 +0200 (Di, 16 Sep 2014) PR libfortran/62768 Handle filenames with embedded null characters. : made the changes like the following to libgfortran/io/close.c #if !HAVE_UNLINK_OPEN_FILE - path = fc_strdup (u->file, u->file_len); + path = strdup (u->filename); #endif One of our users now reported this build failure for a system where (for whatever reason) HAVE_UNLINK_OPEN_FILE is not defined: .../GCC-HEAD/libgfortran/io/close.c:94:11: error: implicit declaration of function ‘strdup’ 94 | path = strdup (u->filename); | ^~~~~~ By #undef-ining HAVE_UNLINK_OPEN_FILE beetween the #include "..." and #include <...> statements in libgfortran/io/close.c I could reproduce this on FreeBSD 11/i386. And I could validate the fix below, both with and without that #undef in place. Tested on i386-unknown-freebsd11.1. Okay to commit? I'd also like to apply this to older release branches (down to GCC 6) since it is obviously broken and the fix appears straightforward. If approved, I'm thinking to wait about a week or two before making each step backwards (from HEAD to 8, 8 to 7, and 7 to 6). Gerald 2018-10-02 Gerald Pfeifer * io/close.c [!HAVE_UNLINK_OPEN_FILE]: Include . Index: libgfortran/io/close.c =================================================================== --- libgfortran/io/close.c (revision 264772) +++ libgfortran/io/close.c (working copy) @@ -26,6 +26,9 @@ see the files COPYING3 and COPYING.RUNTIME respect #include "unix.h" #include "async.h" #include +#if !HAVE_UNLINK_OPEN_FILE +#include +#endif typedef enum { CLOSE_DELETE, CLOSE_KEEP, CLOSE_UNSPECIFIED }