This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 2dde296  testing/fstest: add cleanup to fatutf8
2dde296 is described below

commit 2dde296d4ff0eeca8ad9147bf80d9990cff9926c
Author: fanzhuyun <[email protected]>
AuthorDate: Fri Oct 15 14:21:57 2021 +0800

    testing/fstest: add cleanup to fatutf8
    
    Signed-off-by: fanzhuyun <[email protected]>
---
 testing/fatutf8/fatutf8_main.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/testing/fatutf8/fatutf8_main.c b/testing/fatutf8/fatutf8_main.c
index 8e11517..1ec5686 100644
--- a/testing/fatutf8/fatutf8_main.c
+++ b/testing/fatutf8/fatutf8_main.c
@@ -60,7 +60,7 @@ int main(int argc, FAR char *argv[])
   int len;
 
   char buf[128];
-  char path[256];
+  char path[PATH_MAX];
 
   char *basepath = NULL;
 
@@ -166,5 +166,33 @@ int main(int argc, FAR char *argv[])
       exit(fd);
     }
 
+  printf("\n");
+
+  ret = remove(path);
+  if (ret == 0)
+    {
+      printf("removed %s\n", path);
+      basepath = strrchr(path, '/');
+      if (basepath != NULL)
+        {
+          *basepath = '\0';
+          ret = remove(path);
+          if (ret == 0)
+            {
+              printf("removed %s\n", path);
+            }
+          else
+            {
+              printf("remove failed: %d\n", errno);
+              exit(ret);
+            }
+        }
+    }
+  else
+    {
+      printf("remove failed: %d\n", errno);
+      exit(ret);
+    }
+
   return EXIT_SUCCESS;
 }

Reply via email to