[Bug 2139] New: rtems_rfs_format() can return 0 (indicating success) erroneously

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Fri Aug 9 06:27:33 UTC 2013


https://www.rtems.org/bugzilla/show_bug.cgi?id=2139

             Bug #: 2139
           Summary: rtems_rfs_format() can return 0 (indicating success)
                    erroneously
    Classification: Unclassified
           Product: RTEMS
           Version: HEAD
          Platform: All
        OS/Version: RTEMS
            Status: NEW
          Severity: normal
          Priority: P3
         Component: filesystem
        AssignedTo: chrisj at rtems.org
        ReportedBy: nick.withers at anu.edu.au


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;
  }
____

-- 
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the bugs mailing list