#2139 closed defect (fixed)
rtems_rfs_format() can return 0 (indicating success) erroneously
Reported by: | Nick Withers | Owned by: | Nick Withers |
---|---|---|---|
Priority: | highest | Milestone: | 4.11 |
Component: | fs | Version: | 4.11 |
Severity: | normal | Keywords: | |
Cc: | chrisj@…, nick.withers@… | Blocked By: | |
Blocking: |
Description (last modified by Gedare Bloom)
rtems_rfs_format() calls rtems_rfs_write_root_dir(), which in turn calls rtems_rfs_fs_open().
When this rtems_rfs_fs_open() call fails, rtems_rfs_write_root_dir() returns -1.
rtems_rts_format(), however, considers only a return > 0 from rtems_rfs_write_root_dir() to mean an error and seems to be expecting it to return a POSIX error code:
rc = rtems_rfs_write_root_dir (name);
if (rc > 0)
{
printf ("rtems-rfs: format: writing root dir failed: %d: %s\n",
rc, strerror (rc));
return -1;
}
Changing this code to the following has sorted out *this particular* failure issue for me, but there're quite a few function calls in rtems_rfs_write_root_dir() and I haven't gone through them to make sure the success of each is correctly tested (and hence I haven't provided a patch)...
rc = rtems_rfs_write_root_dir (name);
if (rc != 0)
{
printf ("rtems-rfs: format: writing root dir failed: %d: %s\n",
errno, strerror (errno));
return -1;
}
Attachments (4)
Change History (14)
comment:1 Changed on 08/09/13 at 05:27:45 by Nick Withers
Cc: | Nick Withers added |
---|
comment:2 Changed on 08/20/13 at 08:22:59 by Nick Withers
Owner: | changed from Chris Johns to Nick Withers |
---|
comment:3 Changed on 12/04/13 at 02:47:35 by Nick Withers
Status: | new → assigned |
---|
Changed on 12/04/13 at 03:53:34 by Nick Withers
Attachment: | RTEMS Ticket 2139 rtems_rfs_format() Analysis added |
---|
Changed on 12/04/13 at 03:55:30 by Nick Withers
Attachment: | RTEMS Ticket 2139 rtems_rfs_write_root_dir() Analysis added |
---|
rtems_rfs_write_root_dir() analysis
Changed on 12/04/13 at 04:20:32 by Nick Withers
Attachment: | RTEMS Ticket 2139 rtems_rfs_write_root_dir() Analysis_v1 added |
---|
rtems_rfs_write_root_dir() analysis
comment:4 Changed on 12/04/13 at 04:20:32 by Nick Withers
attachments.isobsolete: | 0 → 1 |
---|
comment:5 Changed on 12/04/13 at 22:46:59 by Chris Johns
Cc: | Chris Johns added |
---|
Changed on 12/05/13 at 02:44:47 by Nick Withers
Attachment: | RTEMS Ticket 2139.patch added |
---|
Correct error return mismatches
comment:6 Changed on 12/05/13 at 02:44:47 by Nick Withers
Only tested with fstests/mrfs_fserror (fails in the same places as pre-patch),
assuming rtems_rfs_fs_open() and rtems_rfs_fs_close() are intended to return 0
on success or -1 with errno set
comment:7 Changed on 11/24/14 at 18:58:28 by Gedare Bloom
Version: | HEAD → 4.11 |
---|
Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11
comment:8 Changed on 12/19/14 at 05:06:18 by Gedare Bloom
Priority: | normal → highest |
---|
Bump priority to highest for tickets with a fix attached or seemingly simple fix proposed in the description or comments.
comment:9 Changed on 12/24/14 at 03:53:38 by Nick Withers <nick.withers@…>
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:10 Changed on 12/24/14 at 03:54:01 by Gedare Bloom
Description: | modified (diff) |
---|
I removed the change to rtems-rfs-rtems.c, which was partially implemented already.
rtems_rfs_format() analysis, in a more readable form