Donny9 commented on a change in pull request #5854: URL: https://github.com/apache/incubator-nuttx/pull/5854#discussion_r835835491
########## File path: fs/romfs/fs_romfsutil.c ########## @@ -436,51 +429,44 @@ static int romfs_cachenode(FAR struct romfs_mountpt_s *rm, return ret; } - /* Now we are pointing to the real entry of interest. Is it a - * directory? Or a file? - */ + ret = romfs_parsefilename(rm, offset, childname); + if (ret < 0) + { + return ret; + } - if (IS_DIRECTORY(next) || IS_FILE(next)) + if (strcmp(childname, ".") != 0 && strcmp(childname, "..") != 0) { - ret = romfs_parsefilename(rm, offset, childname); - if (ret < 0) + if (child == NULL || nodeinfo->rn_count == num - 1) { - return ret; - } + FAR void *tmp; - if (strcmp(childname, ".") != 0 && strcmp(childname, "..") != 0) - { - if (child == NULL || nodeinfo->rn_count == num - 1) + tmp = kmm_realloc(nodeinfo->rn_child, + (num + NODEINFO_NINCR) * + sizeof(FAR struct romfs_nodeinfo_s *)); + if (tmp == NULL) { - FAR void *tmp; - - tmp = kmm_realloc(nodeinfo->rn_child, - (num + NODEINFO_NINCR) * - sizeof(FAR struct romfs_nodeinfo_s *)); - if (tmp == NULL) - { - return -ENOMEM; - } - - nodeinfo->rn_child = tmp; - memset(nodeinfo->rn_child + num, 0, NODEINFO_NINCR * - sizeof(FAR struct romfs_nodeinfo_s *)); - num += NODEINFO_NINCR; + return -ENOMEM; } - child = &nodeinfo->rn_child[nodeinfo->rn_count++]; - if (IS_DIRECTORY(next)) - { - linkoffset = info; - } + nodeinfo->rn_child = tmp; + memset(nodeinfo->rn_child + num, 0, NODEINFO_NINCR * + sizeof(FAR struct romfs_nodeinfo_s *)); Review comment: Done ########## File path: fs/romfs/fs_romfsutil.c ########## @@ -436,51 +429,44 @@ static int romfs_cachenode(FAR struct romfs_mountpt_s *rm, return ret; } - /* Now we are pointing to the real entry of interest. Is it a - * directory? Or a file? - */ + ret = romfs_parsefilename(rm, offset, childname); + if (ret < 0) + { + return ret; + } - if (IS_DIRECTORY(next) || IS_FILE(next)) + if (strcmp(childname, ".") != 0 && strcmp(childname, "..") != 0) { - ret = romfs_parsefilename(rm, offset, childname); - if (ret < 0) + if (child == NULL || nodeinfo->rn_count == num - 1) { - return ret; - } + FAR void *tmp; - if (strcmp(childname, ".") != 0 && strcmp(childname, "..") != 0) - { - if (child == NULL || nodeinfo->rn_count == num - 1) + tmp = kmm_realloc(nodeinfo->rn_child, + (num + NODEINFO_NINCR) * + sizeof(FAR struct romfs_nodeinfo_s *)); Review comment: Done ########## File path: fs/romfs/fs_romfsutil.c ########## @@ -108,44 +108,37 @@ static inline int romfs_checkentry(FAR struct romfs_mountpt_s *rm, return ret; } - /* Now we are pointing to the real entry of interest. Is it a - * directory? Or a file? + /* Get the name of the directory entry. */ + + ret = romfs_parsefilename(rm, offset, name); + if (ret < 0) + { + return ret; + } + + /* Then check if this the name segment we are looking for. The + * string comparison is awkward because there is no terminator + * on entryname (there is a terminator on name, however) */ - if (IS_DIRECTORY(next) || IS_FILE(next)) + if (memcmp(entryname, name, entrylen) == 0 && + strlen(name) == entrylen) Review comment: Done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org