[Ocfs2-tools-devel] [PATCH 1/1] ocfs2-tools: mount not showing fully resolved path

Junxiao Bi junxiao.bi at oracle.com
Tue Nov 24 18:07:26 PST 2015


On 11/25/2015 05:05 AM, Srinivas Eeda wrote:
> In /etc/mtab, device path is not fully resolved because fgets return code
> checked incorrectly. Device path is getting set to /dev/dm-X instead of
> /dev/mapper/xxx.
> 
> Orabug: 22264767
> 
> Signed-off-by: Srinivas Eeda <srinivas.eeda at oracle.com>
Looks good.

Reviewed-by: Junxiao Bi <junxiao.bi at oracle.com>
> ---
>  mount.ocfs2/sundries.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/mount.ocfs2/sundries.c b/mount.ocfs2/sundries.c
> index 2e1b95a..c4e9ccd 100644
> --- a/mount.ocfs2/sundries.c
> +++ b/mount.ocfs2/sundries.c
> @@ -235,7 +235,7 @@ canonicalize_dm_name(const char *ptname)
>  	FILE	*f;
>  	size_t	sz;
>  	char	path[256], name[256], *res = NULL;
> -	int	err;
> +	char	*ret;
>  
>  	snprintf(path, sizeof(path), "/sys/block/%s/dm/name", ptname);
>  	f = fopen(path, "r");
> @@ -243,9 +243,9 @@ canonicalize_dm_name(const char *ptname)
>  		return NULL;
>  
>  	/* read "<name>\n" from sysfs */
> -	err = fgets(name, sizeof(name), f);
> +	ret = fgets(name, sizeof(name), f);
>  	sz = strlen(name);
> -	if (!err && sz > 1) {
> +	if (ret && sz > 1) {
>  		name[sz - 1] = '\0';
>  		snprintf(path, sizeof(path), "/dev/mapper/%s", name);
>  		res = strdup(path);
> 




More information about the Ocfs2-tools-devel mailing list