From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24001 invoked by alias); 29 Aug 2014 21:21:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 23979 invoked by uid 89); 29 Aug 2014 21:21:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-oi0-f47.google.com Received: from mail-oi0-f47.google.com (HELO mail-oi0-f47.google.com) (209.85.218.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 29 Aug 2014 21:21:43 +0000 Received: by mail-oi0-f47.google.com with SMTP id x69so1992363oia.6 for ; Fri, 29 Aug 2014 14:21:41 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.60.59.196 with SMTP id b4mr12914581oer.38.1409347301851; Fri, 29 Aug 2014 14:21:41 -0700 (PDT) Received: by 10.182.228.20 with HTTP; Fri, 29 Aug 2014 14:21:41 -0700 (PDT) Date: Fri, 29 Aug 2014 21:21:00 -0000 Message-ID: Subject: [Patch, fortran, committed] Use ISO C remove() instead of unlink() From: Janne Blomqvist To: Fortran List , GCC Patches Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2014-08/txt/msg02674.txt.bz2 Hi, when removing a file we can instead use the remove() function specified in ISO C instead of unlink(), as found in POSIX, Windows and probably other systems as well. Thus giving us a bit better guarantee about the provided semantics, which header file it's found in etc. Committed to trunk as obvious. Index: gcc/fortran/ChangeLog =================================================================== --- gcc/fortran/ChangeLog (revision 214743) +++ gcc/fortran/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2014-08-30 Janne Blomqvist + + * module.c (gfc_dump_module): Use ISO C remove() instead of POSIX + unlink(). + 2014-08-29 Jeffrey Armstrong PR fortran/62215 Index: gcc/fortran/module.c =================================================================== --- gcc/fortran/module.c (revision 214743) +++ gcc/fortran/module.c (working copy) @@ -6000,7 +6000,7 @@ gfc_dump_module (const char *name, int d module file, even if it was already there. */ if (!dump_flag) { - unlink (filename); + remove (filename); return; } @@ -6040,7 +6040,7 @@ gfc_dump_module (const char *name, int d || crc_old != crc) { /* Module file have changed, replace the old one. */ - if (unlink (filename) && errno != ENOENT) + if (remove (filename) && errno != ENOENT) gfc_fatal_error ("Can't delete module file '%s': %s", filename, xstrerror (errno)); if (rename (filename_tmp, filename)) @@ -6049,7 +6049,7 @@ gfc_dump_module (const char *name, int d } else { - if (unlink (filename_tmp)) + if (remove (filename_tmp)) gfc_fatal_error ("Can't delete temporary module file '%s': %s", filename_tmp, xstrerror (errno)); } -- Janne Blomqvist