From patchwork Thu Oct 20 18:26:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 59235 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B9526383FBBD for ; Thu, 20 Oct 2022 18:27:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9526383FBBD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290455; bh=mIdr76GQnVv1kPXeEqpGA2avdLxHyd8TIFB6X5Np+AI=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=mg1hGNALIm8MDalYJia6aO2/wV/q4laplUANe321N0LBHlA8Y6JBX0UrSEUQp/ONr 5kCSVYkVYAdWbmocd6DUgCTGtieuD7pEmlzmEb+3d9g/U4FitpS0m8TJHFW/ThZ+3i Nsv9X6j8PzkivGSJLm08qn4rhG197fGXIp+np7Os= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by sourceware.org (Postfix) with ESMTPS id A4441384B127 for ; Thu, 20 Oct 2022 18:27:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A4441384B127 Received: by mail-pj1-x1035.google.com with SMTP id pb15so189107pjb.5 for ; Thu, 20 Oct 2022 11:27:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mIdr76GQnVv1kPXeEqpGA2avdLxHyd8TIFB6X5Np+AI=; b=fDEJN9L3a1Izw/ccg010HAkOjpBjWiMNET5IaVGZnpZ0qL6h1RY1G8WdiI93PYLiqt UzCWvfw4theowVoDLFVJbbOuBk/uCjVVBlaWcVcDmx9OxVm57YzCOF9qR/QjBpttnIqG QWWyVvlTUrLDYVz5EdYT8rPLNKO2Cr6jexqfBkCYLHy33v0NKDMJy4v3qb7jZ1b7eo0W TitYdGTwA1Xn0HANzAp34EqemhdqLVZN19vUS6y8NovSThco9nG8rwEOyeXCn6kqqX29 MS2fM3EgTiFonrPuPpxY5WPnpc5bpfLRiaoQAcvyU5Zc0flLIw54FUoJTneohBaL8Wbn V18A== X-Gm-Message-State: ACrzQf3AUPGsa4bgBhFh7fCQKwfX8+yMV4ZNbXyUM+x9mZRUTM5Im9Jx oQ+BZY7Fk41de373gymBZLel7wi4ns0XFg== X-Google-Smtp-Source: AMsMyM7JDD1smTmiPpYWwStwAeVpGeudoUlaWb+/cd8mR/FZQgQMqxwu9aOd7kMfxbMtXPwOIZ4MtA== X-Received: by 2002:a17:90b:4b0f:b0:211:41f:1c72 with SMTP id lx15-20020a17090b4b0f00b00211041f1c72mr7665997pjb.25.1666290432358; Thu, 20 Oct 2022 11:27:12 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.27.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:27:11 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 23/25] libasm/debuginfod: fchmod doesn't present on win32 Date: Fri, 21 Oct 2022 02:26:02 +0800 Message-Id: <20221020182603.815-24-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Yonggang Luo via Elfutils-devel From: Yonggang Luo Reply-To: Yonggang Luo Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Signed-off-by: Yonggang Luo --- debuginfod/debuginfod-client.c | 4 +++- libasm/asm_end.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index 2a14d9d9..4b7f837b 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -1405,9 +1405,11 @@ debuginfod_query_server (debuginfod_client *c, tvs[0].tv_usec = tvs[1].tv_usec = 0; (void) futimes (fd, tvs); /* best effort */ +#if !defined(_WIN32) /* PR27571: make cache files casually unwriteable; dirs are already 0700 */ (void) fchmod(fd, 0400); - +#endif + /* rename tmp->real */ rc = rename (target_cache_tmppath, target_cache_path); if (rc < 0) diff --git a/libasm/asm_end.c b/libasm/asm_end.c index c06d2366..54540bc1 100644 --- a/libasm/asm_end.c +++ b/libasm/asm_end.c @@ -512,12 +512,14 @@ asm_end (AsmCtx_t *ctx) if (result != 0) return result; +#if !defined(_WIN32) /* Make the new file globally readable and user/group-writable. */ if (fchmod (ctx->fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH) != 0) { __libasm_seterrno (ASM_E_CANNOT_CHMOD); return -1; } +#endif /* Rename output file. */ if (rename (ctx->tmp_fname, ctx->fname) != 0)