Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
debuginfod/debuginfod-client.c | 4 +++-
libasm/asm_end.c | 2 ++
2 files changed, 5 insertions(+), 1 deletion(-)
@@ -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)
@@ -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)