You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/03/29 06:44:25 UTC

[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on a change in pull request #637: testing/fstest: Add hash checking of file's name to avoid creating same-name file

xiaoxiang781216 commented on a change in pull request #637:
URL: https://github.com/apache/incubator-nuttx-apps/pull/637#discussion_r603046338



##########
File path: testing/fstest/fstest_main.c
##########
@@ -188,6 +189,29 @@ static inline char fstest_randchar(void)
     }
 }
 
+/****************************************************************************
+ * Name: fstest_checkexit
+ ****************************************************************************/
+
+static bool fstest_checkexit(FAR struct fstest_filedesc_s *file)
+{
+  int i;
+  bool ret = false;
+
+  for (i = 0; i < CONFIG_TESTING_FSTEST_MAXOPEN; i++)
+    {
+      if (!g_files[i].deleted &&
+          &g_files[i] != file &&
+          g_files[i].hash == file->hash)

Review comment:
       why not directly compare filename to avoid the potential collision?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org