From patchwork Sat Jan 26 20:42:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry DeLisle X-Patchwork-Id: 1031499 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-494782-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=charter.net Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="RUGO3Ld9"; 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 43n79l11ctz9sBQ for ; Sun, 27 Jan 2019 07:42:16 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=RBBaNELAERuyJyX/ NuI1MZ8GquGf7l4F8B+AAi12K9WHNTH8+xLPqHpFj5dIGLfK8rsYznvUcNQ2pcQL YTuKNiF0V67JQYgaPnQBncGJafQptn9wYtUvbyI1U2SqVibVWRYvN7UZOKIlCI7l PCZiwd+PICl7EHv4IMk79BaYzS0= 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:to:cc :from:subject:message-id:date:mime-version:content-type :content-transfer-encoding; s=default; bh=2B3Ts5DAYtDXuKoxAdkDEa wlZbA=; b=RUGO3Ld9HoFB8KYI8JCaGXColUaX6rtTOwgfNUwI/YHfULoJQD54/M 0qL1RQ37a4dqp6mEkpGgV6A+89gSv3Vf4LwFFl2nsBcWzdB3YgnwLDTO0jQkfcKa FgETtIppw6nKSxt2fqxX5xrB2mu1ps5qtyDfvBZsZe49KUnuwRvcA= Received: (qmail 40889 invoked by alias); 26 Jan 2019 20:42:09 -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 40867 invoked by uid 89); 26 Jan 2019 20:42:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_SORBS_WEB, SPF_PASS autolearn=ham version=3.3.2 spammy=HAuthentication-Results:auth, HX-Envelope-From:sk:jvdelis, H*F:U*jvdelisle, H*M:charter X-HELO: impout008.msg.chrl.nc.charter.net Received: from impout008aa.msg.chrl.nc.charter.net (HELO impout008.msg.chrl.nc.charter.net) (47.43.20.32) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 26 Jan 2019 20:42:08 +0000 Received: from [172.16.0.219] ([66.96.68.196]) by cmsmtp with ESMTPA id nUmDg144nYOHFnUmEglRVu; Sat, 26 Jan 2019 20:42:06 +0000 Authentication-Results: charter.net; auth=pass (PLAIN) smtp.auth=jvdelisle@charter.net To: "fortran@gcc.gnu.org" Cc: GCC Patches From: Jerry DeLisle Subject: [patch, libgfortran, committed] PR89020 Message-ID: Date: Sat, 26 Jan 2019 12:42:04 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 Committed as simple and obvious. (With a ChangeLog Bobble fixed) Regression tested on x86_64. Committed r268301 M libgfortran/ChangeLog M libgfortran/io/close.c Regards, Jerry 2019-01-26 Jerry DeLisle PR libfortran/89020 * io/close.c (st_close): Generate error if calls to 'remove' return an error. diff --git a/libgfortran/io/close.c b/libgfortran/io/close.c index cbcbf4e71a1..2b35e49c9cc 100644 --- a/libgfortran/io/close.c +++ b/libgfortran/io/close.c @@ -99,7 +99,11 @@ st_close (st_parameter_close *clp) else { #if HAVE_UNLINK_OPEN_FILE - remove (u->filename); + + if (remove (u->filename)) + generate_error (&clp->common, LIBERROR_OS, + "File cannot be deleted, possibly in use by" + " another process"); #else path = strdup (u->filename); #endif @@ -112,7 +116,10 @@ st_close (st_parameter_close *clp) #if !HAVE_UNLINK_OPEN_FILE if (path != NULL) { - remove (path); + if (remove (u->filename)) + generate_error (&clp->common, LIBERROR_OS, + "File cannot be deleted, possibly in use by" + " another process"); free (path); } #endif