From patchwork Fri Jan 6 08:31:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 39995 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp712312wrt; Fri, 6 Jan 2023 00:32:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXsh+nHCC6L1SWyEXqjlfz2OOHHDDulKNgECTcN3AB1SV1pXHNOqC885Xx4N0T19C288QcKS X-Received: by 2002:a17:907:c242:b0:7c1:453f:1aae with SMTP id tj2-20020a170907c24200b007c1453f1aaemr58803599ejc.37.1672993963668; Fri, 06 Jan 2023 00:32:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672993963; cv=none; d=google.com; s=arc-20160816; b=Xch48WaQCEFyh85DOyknvIzOaW7DfkWY/J485HxD7tszBvGswbLYwD/K3AzHwDS5ye cPqSfJf3BNd0gViG97F84GPc0Be5JkyM6N84R73Sv5SgjQIhc4p4DoRu9xf8lstlfa5/ I4e/EJOb2gCYy7IDo0yFVGYzkpXAMOiDlGXEg3X58wJt41WWn7+oY7KkHZ9c1pShVtTq 5XBGFdXraQl9vbsoYz5ZqQJGx2h5dUlyoxf7/otqoFStZUfrkqcAlTxINQigSfQxEZiw jryTMl+HVlnQFnOXldXyehhaawFd6U0MCbUmMbMOEepMJX4QQAAZLf1NkIVHGjV7DrsC 1b1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=7opx/jX5fXVzDjRTXSKv9qYOP2Q6jP02XPpZ2agfOYk=; b=y48f83cR9K7a6lOal6ciFJjZpMRyvzh9DQjP7S/UnsKOix60T/+U+6FEF72fNqw5Ic FmSC4gtsPWg5+T7zLHYFq2vCYVG/qCirTXIPQY62Ix7B14iDGHcvT+0Rqje0Yc3F5xp+ bGQXXE5FiMqcUL7ejMCKfOa2ilHJkJBd20MYC2tfv8CgK/M+vmO7I6DBcYQyU2vBDZdk w+M7EmTyFD4CWrOWg/6DzEMtfAetLdLlwrt0jpTOlDEWXIOdfsb/YOElnGkJRc3VGiQk 4va37t2hINAvEqs6hhsKDUEM7Hs4LEYFm8w9NVdxQ8Y13gQYG1yQJFV5/GzHNZRf2t1X mOXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="Pi3r/j/V"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id z12-20020a05640235cc00b0048f0fcee950si1117990edc.492.2023.01.06.00.32.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 00:32:43 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="Pi3r/j/V"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7AEDF3858D28 for ; Fri, 6 Jan 2023 08:32:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7AEDF3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672993962; bh=7opx/jX5fXVzDjRTXSKv9qYOP2Q6jP02XPpZ2agfOYk=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Pi3r/j/Vxxv1uq9EdHMr9T0eLQg7SZMIf3jPeqBOuxVGO0WunKgr14iSXCBYOhIqL X2gj/3otBT12HhpebPJlQsRiYLbwI9gaCROqH/B7hlcgnLvatCWZkLzZIkAlq+nMb+ RPMMrJ0gESXEyrI93Zy4tdFugR0CVRZnpwrQs27M= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from sonic316-22.consmr.mail.ne1.yahoo.com (sonic316-22.consmr.mail.ne1.yahoo.com [66.163.187.148]) by sourceware.org (Postfix) with ESMTPS id AF48A3858D28 for ; Fri, 6 Jan 2023 08:31:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AF48A3858D28 X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1672993913; bh=37vflfUzwmFNaR3jFJFY2ptAvYSE981Qa84Fj4InIek=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=VDXSbhJ0NJlQYHrPllqX1OCIAfhmuTE1ZKJyCt6qqWFJ1tQIx4AYG4BW5kM5kr1PBe1u0E2VVoM9o8rpoCFJKp4DeJl3GVSr4cJilyFDtc1c9T7dcC9PgitPxGMQChCyBo97J17DMc7sqRFNkMhZzQmfbvToqOVMuGgZ/HPcz2re7I91s/I1DFMnTtMv6MlMJyXMHzrBVBYRxoNPGlq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erUvaWvNXWCvsC6B3S5qFnTjMbe1 5SUDXkafgSAEnIXWHxDwE0MuHZ5ZauvxgP9K6Y6C2MTaWRjcGlOKN5Khv6twnHZOOlK9FXZrOSCj S.ZMZUtHD3TqRZQ2OwncOZOVH4qMdT990DfL9qMh1mESvymABKYJ7qh9y7avZjYyeLkj3DAu1_xZ kXbtQQq83zTFyNufIuhrj7eDBfN.yeOBHI_p4vMf2CK60o6Pd1qBBaIqyfBXW1GTZh5Xhiw_r0j1 cobC_QHc0iNo_giJrOBMsKrbklbxs.hq5_OpRQgvAgG0- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.ne1.yahoo.com with HTTP; Fri, 6 Jan 2023 08:31:53 +0000 Received: by hermes--production-gq1-d898c4779-kpcpf (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID f0f83334c17b94277bf1625af9158c36; Fri, 06 Jan 2023 08:31:47 +0000 (UTC) To: gcc-patches@gcc.gnu.org Cc: Himal Subject: [PATCH] Handle Windows nul device in unlink-if-ordinary.c Date: Fri, 6 Jan 2023 14:01:18 +0530 Message-Id: <20230106083118.2141-1-anothername27-unity@yahoo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: anothername27-unity--- via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: anothername27-unity@yahoo.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754260799037711990?= X-GMAIL-MSGID: =?utf-8?q?1754261318507107405?= From: Himal Hi, This might be a better fix. Regards. PS. I had to use a different email. --- libiberty/unlink-if-ordinary.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libiberty/unlink-if-ordinary.c b/libiberty/unlink-if-ordinary.c index 84328b216..e765ac8b1 100644 --- a/libiberty/unlink-if-ordinary.c +++ b/libiberty/unlink-if-ordinary.c @@ -62,6 +62,12 @@ was made to unlink the file because it is special. int unlink_if_ordinary (const char *name) { +/* MS-Windows 'stat' function (and in turn, S_ISREG) + reports the null device as a regular file. */ +#ifdef _WIN32 + if (stricmp (name, "nul") == 0) + return 1; +#endif struct stat st; if (lstat (name, &st) == 0