Skip to content

Commit

Permalink
Check the return value of chmod
Browse files Browse the repository at this point in the history
  • Loading branch information
Todd Martin authored and Todd Martin committed Oct 8, 2021
1 parent 77db4f4 commit 355a1dc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ut_assert/src/uttools.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ bool UtMem2HexFile(const void *Memory, const char *Filename, uint32 Length)
{
if (stat(Filename, &dststat) == 0)
{
chmod(Filename, dststat.st_mode & ~(S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH));
if((chmod(Filename, dststat.st_mode & ~(S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH)) == 0))
{
stat(Filename, &dststat);
}
}

for (i = 0; i < Length; i += 16)
Expand Down

0 comments on commit 355a1dc

Please sign in to comment.