From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127980 invoked by alias); 2 Oct 2018 11:08:51 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@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, 02 Oct 2018 11:08:00 -0000 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 Content-Type: multipart/mixed; BOUNDARY="0-1813475191-1538380632=:3785" X-SW-Source: 2018-10/txt/msg00004.txt.bz2 --0-1813475191-1538380632=:3785 Content-Type: text/plain; CHARSET=ISO-8859-7 Content-Transfer-Encoding: 8BIT Content-length: 1765 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 } --0-1813475191-1538380632=:3785--