[Ocfs2-tools-devel] [PATCH 1/1] ocfs2-tools: mount not showing fully resolved path
Joseph Qi
joseph.qi at huawei.com
Tue Nov 24 18:45:58 PST 2015
On 2015/11/25 10:32, Gang He wrote:
> The fix looks good, just one more question,
> did you really encounter any problem here before? thanks.
>
> Reviewed-by: Gang He <ghe at suse.com>
>
>
>>>>
>> 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>
Reviewed-by: Joseph Qi <joseph.qi at huawei.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);
>>>
>>
>>
>> _______________________________________________
>> Ocfs2-tools-devel mailing list
>> Ocfs2-tools-devel at oss.oracle.com
>> https://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel
>
>
> _______________________________________________
> Ocfs2-tools-devel mailing list
> Ocfs2-tools-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel
>
>
More information about the Ocfs2-tools-devel
mailing list