[Ocfs2-tools-devel] [PATCH 1/1] ocfs2-tools: mount not showing fully resolved path
Srinivas Eeda
srinivas.eeda at oracle.com
Tue Nov 24 13:05:04 PST 2015
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>
---
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);
--
1.9.1
More information about the Ocfs2-tools-devel
mailing list