[Ocfs2-tools-devel] [PATCH] libocfs2: Fix errno return from ocfs2_get_device_sectsize()
Tao Ma
tao.ma at oracle.com
Wed Mar 11 18:28:50 PDT 2009
sob.
Joel Becker wrote:
> ocfs2_get_device_sectsize() is declared as returning errcode_t, but it
> was returning a raw errno when open64() failed. Let's give it a proper
> error.
>
> Signed-off-by: Joel Becker <joel.becker at oracle.com>
> ---
> libocfs2/getsectsize.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/libocfs2/getsectsize.c b/libocfs2/getsectsize.c
> index c487733..459f602 100644
> --- a/libocfs2/getsectsize.c
> +++ b/libocfs2/getsectsize.c
> @@ -52,8 +52,12 @@ errcode_t ocfs2_get_device_sectsize(const char *file, int *sectsize)
> #else
> fd = open(file, O_RDONLY);
> #endif
> - if (fd < 0)
> - return errno;
> + if (fd < 0) {
> + if (errno == ENOENT)
> + return OCFS2_ET_NAMED_DEVICE_NOT_FOUND;
> + else
> + return OCFS2_ET_IO;
> + }
>
> ret = OCFS2_ET_CANNOT_DETERMINE_SECTOR_SIZE;
> #ifdef BLKSSZGET
More information about the Ocfs2-tools-devel
mailing list