This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[ECOS] Bug correction for jffs2_open


Hello,

"jffs2_open" function should always return positive error code.

This is not the case.

When the file is opened with "O_CREAT" flag and the file doesn't exist
"jffs2_open" calls "jffs2_create". In case "jffs2_create" fails the
returned error code, which is negative, is immediately returned.

The proposed patch simply change error code sign.

Regards.

Vincent CATROS
ELIOS Informatique
http://www.elios-informatique.fr

PS : This is the first time I submit a patch for eCos communauty. If the
way I've done it or my patch format is not good, tell me.

Index: fs-ecos.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/src/fs-ecos.c,v
retrieving revision 1.16
diff -u -5 -p -r1.16 fs-ecos.c
--- fs-ecos.c	11 Dec 2003 23:33:54 -0000	1.16
+++ fs-ecos.c	7 Jan 2004 13:10:22 -0000
@@ -691,11 +691,11 @@ static int jffs2_open(cyg_mtab_entry * m
 
 			// No node there, if the O_CREAT bit is set then
we must
 			// create a new one. The dir and name fields of
the dirsearch
 			// object will have been updated so we know
where to put it.
 
-			err = jffs2_create(ds.dir, ds.name,
S_IRUGO|S_IXUGO|S_IWUSR|S_IFREG, &node);
+			err = -jffs2_create(ds.dir, ds.name,
S_IRUGO|S_IXUGO|S_IWUSR|S_IFREG, &node);
 
 			if (err != 0) {
 				//Possible orphaned inode on the flash -
but will be gc'd
 				return err;
 			}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]