From ae298390ed7a35f11455190fb76d7ac17e95e59a Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 30 Apr 2011 23:24:48 +0000 Subject: [PATCH] Misc NXFFS bug fixes git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3545 42af7a65-404d-4744-a932-0658087f49c3 --- examples/nxffs/nxffs_main.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/nxffs/nxffs_main.c b/examples/nxffs/nxffs_main.c index 9a3532e2c..bef334aa4 100644 --- a/examples/nxffs/nxffs_main.c +++ b/examples/nxffs/nxffs_main.c @@ -172,7 +172,7 @@ static inline void nxffs_randname(FAR struct nxffs_filedesc_s *file) if (!file->name) { fprintf(stderr, "ERROR: Failed to allocate name, length=%d\n", namelen); - exit(3); + exit(5); } memcpy(file->name, g_mountdir, dirlen); @@ -335,13 +335,19 @@ int user_start(int argc, char *argv[]) exit(3); } - /* Then write a file to the NXFFS file system */ + /* Then write a files to the NXFFS file system until either (1) all of the + * open file structures are utilized or until (2) NXFFS reports an error + * (hopefully that the file system is full) + */ - ret = nxffs_wrfile(); - if (ret < 0) + for (;;) { - fprintf(stderr, "ERROR: Failed to write a file\n"); - exit(3); + ret = nxffs_wrfile(); + if (ret < 0) + { + fprintf(stderr, "ERROR: Failed to write a file\n"); + exit(4); + } } return 0;