Bug of libcsupport open?

Joel Sherrill joel.sherrill at OARcorp.com
Fri Aug 22 13:42:28 UTC 2008

Wei Shen wrote:
> Hi,
> If "iop->handlers->open_h" returns an error, "open" will call 
> "rtems_set_errno_and_return_minus_one( rc )" which sets "errno" to 
> "rc", where "rc" is the return value of "open_h".
> However, the "open_h" handler implemented by each filesystem usually 
> already sets "errno" and returns only -1 at errors, so "open" will 
> override "errno" with -1 which is not a valid errno.
I think you are correct.  And my scan of the open implementations
in cpukit/libfs indicates a possible mix in returns. 

I think open() should assume -1 returned and errno set.  This
makes it up to the specific handlers to do the right thing.

Do you have a patch?
> Regards,
> Wei

Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

More information about the users mailing list