This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
[ECOS] Bug correction for jffs2_open
- From: Vincent CATROS <vincent dot catros at elios-informatique dot fr>
- To: ecos-patches at ecos dot sourceware dot org
- Date: 09 Jan 2004 16:16:59 +0100
- Subject: [ECOS] Bug correction for jffs2_open
Hello,
Forget my previous e-mail with the same title, patch format was not good
(thanks Andrew ;-)) ).
Try the one bellow hoping it will be good this time.
Description :
"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
Index: packages/fs/jffs2/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/ChangeLog,v
retrieving revision 1.23
diff -u -r1.23 ChangeLog
--- packages/fs/jffs2/current/ChangeLog 6 Jan 2004 19:01:36 -0000 1.23
+++ packages/fs/jffs2/current/ChangeLog 9 Jan 2004 14:04:10 -0000
@@ -1,3 +1,7 @@
+2004-01-09 Vincent Catros <vincent.catros@elios-informatique.fr>
+
+ * src/fs-ecos.c: errno is no longer negative when jffs_open fails.
+
2004-01-05 Thomas Koeller <thomas.koeller@baslerweb.com>
* cdl/jffs2.cdl: Re-added CYGPKG_FS_JFFS2_CFLAGS_REMOVE that had been
Index: packages/fs/jffs2/current/src/fs-ecos.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/src/fs-ecos.c,v
retrieving revision 1.16
diff -u -r1.16 fs-ecos.c
--- packages/fs/jffs2/current/src/fs-ecos.c 11 Dec 2003 23:33:54 -0000 1.16
+++ packages/fs/jffs2/current/src/fs-ecos.c 9 Jan 2004 14:04:11 -0000
@@ -693,7 +693,7 @@
// 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