From patchwork Sat Dec 17 16:52:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 62098 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 42B103AA9816 for ; Sat, 17 Dec 2022 16:54:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 42B103AA9816 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1671296053; bh=rbVelM/MgOrT6rKBYctYIGNyGIF6O+Yx193ds2IPhs4=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=OhMN3gVjuRnOnQqix8yq2Q5cS7dSGhIciqGHAb8XR+vsAz2Hs/QRBGtfoUvQXV4xY GQAHbOwyKrIQhWZRP++JyfbSROalTLM4FmUqtSmgzeqzElAyw/vgrLG0/jbe/4Ll7f x4KSaWZaj9jV5cFpn3YKYbkioiEGH37m3Jn0N3js= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by sourceware.org (Postfix) with ESMTPS id 6C3513AA9819 for ; Sat, 17 Dec 2022 16:52:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6C3513AA9819 Received: by mail-pj1-x1031.google.com with SMTP id o1-20020a17090a678100b00219cf69e5f0so9078919pjj.2 for ; Sat, 17 Dec 2022 08:52:56 -0800 (PST) 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=rbVelM/MgOrT6rKBYctYIGNyGIF6O+Yx193ds2IPhs4=; b=AOHCoaK4Efx0szF9NBLa/0V/HvRN/O9WAvEs8wyH9RC0quA60SHeHeeShOBgOEz9wp 0Jlcf9Z1TEpKa3v+bc7/b4/uXCvmaFcECINFEMVT3/hCSfZLyraSivbEVREIvnplfJqb V+mA4eqdRrJ6c2lIrz1I16+GAjf87Q7kmWIblxq4Gsmp3HBco63+ep25KV7rCEb813UA PAdX7cmJrQ2y1x8aK4wOMATPt6+2O9lCFOZ9ncjnfkmRzycFasM4pRQULquLx67KSzSV dUtx4Z+Wxram25+iFUY0XkivDz3rOHjYG2ANhYmxiRWieG5b0DvCY0UWfwL1EJ8ixoui jWHQ== X-Gm-Message-State: AFqh2koBznF94KJ0ElTDpyp5x9m+fDcsOhG2Al9h5jgs9QmoJmtjhgoB XWCGtGfeMN00HMh8wHu5EipeE/f6NgE= X-Google-Smtp-Source: AMrXdXunI69MiBN9bsNuW0n4mGRf9xYs6kyOqq8aZSRkTlnT5P2zHXuHqlCcF+e7LHLtfd9Y1J+0Hw== X-Received: by 2002:a17:90a:d318:b0:219:23e5:dcbe with SMTP id p24-20020a17090ad31800b0021923e5dcbemr2739906pju.19.1671295975740; Sat, 17 Dec 2022 08:52:55 -0800 (PST) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id s92-20020a17090a2f6500b002191873187dsm6643229pjd.33.2022.12.17.08.52.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Dec 2022 08:52:55 -0800 (PST) To: elfutils-devel@sourceware.org Cc: Yonggang Luo Subject: [PATCH v2 12/16] libasm/debuginfod: fchmod doesn't present on win32 Date: Sun, 18 Dec 2022 00:52:09 +0800 Message-Id: <20221217165213.152-13-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221217165213.152-1-luoyonggang@gmail.com> References: <20221217165213.152-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 8873fcc8..7a67a440 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -1708,9 +1708,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)