[23/25] libasm/debuginfod: fchmod doesn't present on win32

Message ID 20221020182603.815-24-luoyonggang@gmail.com
State New
Headers
Series Patches for building with mingw/gcc msvc/clang-cl |

Commit Message

Yonggang Luo Oct. 20, 2022, 6:26 p.m. UTC
  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(-)
  

Patch

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)