Skip to content

Commit

Permalink
Fix #87, Check return value of stat
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Nov 12, 2022
1 parent 46b29f8 commit 836486f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion elf2cfetbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,12 @@ int32 OpenDstFile(void)
if (Verbose)
printf("%s: Destination file permissions after open = 0x%X\n", DstFilename, dststat.st_mode);
chmod(DstFilename, dststat.st_mode & ~(S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH));
stat(DstFilename, &dststat);

if (stat(DstFilename, &dststat) != 0)
{
printf("%s: Error retrieving file status after chmod\n", DstFilename);
}

if (Verbose)
printf("%s: Destination file permissions after chmod = 0x%X\n", DstFilename, dststat.st_mode);
}
Expand Down

0 comments on commit 836486f

Please sign in to comment.