This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
[ECOS] write to full RamFS file-system always return ENOERR
- From: "Vincent Catros" <Vincent dot Catros at elios-informatique dot fr>
- To: <ecos-patches at ecos dot sourceware dot org>
- Date: Thu, 8 Jan 2004 14:55:10 +0100
- Subject: [ECOS] write to full RamFS file-system always return ENOERR
Hello,
Writing to a file on a full RamFS file-system always return "0" instead
of ENOSPC.
This is due to a bug in "ramfs_fo_write" which always return "ENOERR".
You will find below a patch to fix this issue.
Regards.
Vincent CATROS
ELIOS Informatique
http://www.elios-informatique.fr
Index: ramfs.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/ram/current/src/ramfs.c,v
retrieving revision 1.4
diff -u -5 -p -r1.4 ramfs.c
--- ramfs.c 23 May 2002 23:01:39 -0000 1.4
+++ ramfs.c 8 Jan 2004 13:48:51 -0000
@@ -2088,10 +2088,11 @@ static int ramfs_fo_write (struct CY
{
ramfs_node *node = (ramfs_node *)fp->f_data;
off_t pos = fp->f_offset;
ssize_t resid = uio->uio_resid;
int i;
+ int err = ENOERR;
// If the APPEND mode bit was supplied, force all writes to
// the end of the file.
if( fp->f_flag & CYG_FAPPEND )
pos = fp->f_offset = node->size;
@@ -2113,11 +2114,10 @@ static int ramfs_fo_write (struct CY
while( len > 0 )
{
cyg_uint8 *fbuf;
size_t bsize;
off_t l = len;
- int err;
err = findbuffer_node( node, pos, &fbuf, &bsize, true );
// Stop writing if there is no more space in the file and
// indicate end of data.
@@ -2151,11 +2151,11 @@ static int ramfs_fo_write (struct CY
node->size = pos;
uio->uio_resid = resid;
fp->f_offset = pos;
- return ENOERR;
+ return err;
}
//
------------------------------------------------------------------------
-
// ramfs_fo_lseek()
// Seek to a new file position.