From 42a1eedbd0a4fba1604976906c25f86569e8da12 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 4 Oct 2022 11:24:52 -0400 Subject: [PATCH] HotFix #1300, do not set file permissions on UT assert outputs File permissions in general are a POSIX concept, but this tool should be pure C99. It should not rely on any POSIX headers or POSIX-specific API calls. --- ut_assert/src/uttools.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/ut_assert/src/uttools.c b/ut_assert/src/uttools.c index 3fc92ed13..57d5a809e 100644 --- a/ut_assert/src/uttools.c +++ b/ut_assert/src/uttools.c @@ -31,7 +31,6 @@ #include #include #include -#include #include "common_types.h" #include "utassert.h" @@ -54,18 +53,10 @@ typedef struct bool UtMem2BinFile(const void *Memory, const char *Filename, uint32 Length) { - FILE * fp; - int fd; - struct stat dststat; + FILE *fp; if ((fp = fopen(Filename, "w"))) { - fd = fileno(fp); - if (fstat(fd, &dststat) == 0) - { - fchmod(fd, dststat.st_mode & ~(S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH)); - } - fwrite(Memory, Length, 1, fp); fclose(fp); return true; @@ -102,20 +93,12 @@ bool UtBinFile2Mem(void *Memory, const char *Filename, uint32 Length) bool UtMem2HexFile(const void *Memory, const char *Filename, uint32 Length) { - FILE * fp; - uint32 i; - uint32 j; - int fd; - struct stat dststat; + FILE * fp; + uint32 i; + uint32 j; if ((fp = fopen(Filename, "w"))) { - fd = fileno(fp); - if (fstat(fd, &dststat) == 0) - { - fchmod(fd, dststat.st_mode & ~(S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH)); - } - for (i = 0; i < Length; i += 16) { fprintf(fp, " %06lX: ", (unsigned long)i);