tools/gencromfs.c: Was duplicating all mode bits in source directory in CROMFS directory. Some make no sense. In particular, all write-able bits are cleard unconditionally. Executable bits are still copying because there is really no way for the tool to know if the file is executable or not.

This commit is contained in:
Gregory Nutt
2018-03-24 15:05:22 -06:00
parent 67e0603b5a
commit db3b507a41
2 changed files with 4 additions and 17 deletions
+3 -16
View File
@@ -842,16 +842,13 @@ static uint16_t get_mode(mode_t mode)
{ {
uint16_t ret = 0; uint16_t ret = 0;
/* Convert mode to CROMFS NuttX read-only mode */
if ((mode & S_IXOTH) != 0) if ((mode & S_IXOTH) != 0)
{ {
ret |= NUTTX_IXOTH; ret |= NUTTX_IXOTH;
} }
if ((mode & S_IWOTH) != 0)
{
ret |= NUTTX_IWOTH;
}
if ((mode & S_IROTH) != 0) if ((mode & S_IROTH) != 0)
{ {
ret |= NUTTX_IROTH; ret |= NUTTX_IROTH;
@@ -862,11 +859,6 @@ static uint16_t get_mode(mode_t mode)
ret |= NUTTX_IXGRP; ret |= NUTTX_IXGRP;
} }
if ((mode & S_IWGRP) != 0)
{
ret |= NUTTX_IWGRP;
}
if ((mode & S_IRGRP) != 0) if ((mode & S_IRGRP) != 0)
{ {
ret |= NUTTX_IRGRP; ret |= NUTTX_IRGRP;
@@ -877,11 +869,6 @@ static uint16_t get_mode(mode_t mode)
ret |= NUTTX_IXUSR; ret |= NUTTX_IXUSR;
} }
if ((mode & S_IWUSR) != 0)
{
ret |= NUTTX_IWUSR;
}
if ((mode & S_IRUSR) != 0) if ((mode & S_IRUSR) != 0)
{ {
ret |= NUTTX_IRUSR; ret |= NUTTX_IRUSR;
@@ -917,7 +904,7 @@ static void gen_dirlink(const char *name, uint32_t tgtoffs, bool dirempty)
/* Generate the hardlink node */ /* Generate the hardlink node */
dump_nextline(g_tmpstream); dump_nextline(g_tmpstream);
fprintf(g_tmpstream, "\n /* Offset %6lu: Hard link %s*/\n\n", fprintf(g_tmpstream, "\n /* Offset %6lu: Hard link %s */\n\n",
(unsigned long)g_offset, name); (unsigned long)g_offset, name);
node.cn_mode = TGT_UINT16(DIRLINK_MODEFLAGS); node.cn_mode = TGT_UINT16(DIRLINK_MODEFLAGS);