Merge pull request #165 from prife/jffs2-fix

DFS/jffs2: fix file mode init bug in jffs2_open/opendir
This commit is contained in:
Bernard Xiong 2013-09-28 00:42:04 -07:00
commit 0d378bbeac
2 changed files with 3 additions and 1 deletions

View File

@ -178,6 +178,7 @@ static int dfs_jffs2_mount(struct dfs_filesystem* fs,
result = jffs2_mount(NULL, mte); result = jffs2_mount(NULL, mte);
if (result != 0) if (result != 0)
{ {
device_partition[index].dev = NULL;
return jffs2_result_to_dfs(result); return jffs2_result_to_dfs(result);
} }
/* save this pointer */ /* save this pointer */

View File

@ -747,7 +747,7 @@ int jffs2_open(cyg_mtab_entry * mte, cyg_dir dir, const char *name,
} }
// Initialise the file object // Initialise the file object
file->f_flag |= mode & CYG_FILE_MODE_MASK; file->f_flag = mode & CYG_FILE_MODE_MASK;
file->f_type = CYG_FILE_TYPE_FILE; file->f_type = CYG_FILE_TYPE_FILE;
file->f_ops = &jffs2_fileops; file->f_ops = &jffs2_fileops;
file->f_offset = (mode & O_APPEND) ? node->i_size : 0; file->f_offset = (mode & O_APPEND) ? node->i_size : 0;
@ -1065,6 +1065,7 @@ static int jffs2_opendir(cyg_mtab_entry * mte, cyg_dir dir, const char *name,
// Initialize the file object, setting the f_ops field to a // Initialize the file object, setting the f_ops field to a
// special set of file ops. // special set of file ops.
file->f_flag = 0;
file->f_type = CYG_FILE_TYPE_FILE; file->f_type = CYG_FILE_TYPE_FILE;
file->f_ops = &jffs2_dirops; file->f_ops = &jffs2_dirops;
file->f_offset = 0; file->f_offset = 0;