git.annexia.org
/
libguestfs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fab75c0
)
daemon: findfs-uuid and findfs-label should not return /dev/mapper paths.
author
Richard W.M. Jones
<rjones@redhat.com>
Tue, 16 Nov 2010 15:56:11 +0000
(15:56 +0000)
committer
Richard W.M. Jones
<rjones@redhat.com>
Tue, 16 Nov 2010 15:56:54 +0000
(15:56 +0000)
daemon/findfs.c
patch
|
blob
|
history
diff --git
a/daemon/findfs.c
b/daemon/findfs.c
index
0520f18
..
061ab0a
100644
(file)
--- a/
daemon/findfs.c
+++ b/
daemon/findfs.c
@@
-56,6
+56,22
@@
findfs (const char *tag, const char *label_or_uuid)
if (len > 0 && out[len-1] == '\n')
out[len-1] = '\0';
if (len > 0 && out[len-1] == '\n')
out[len-1] = '\0';
+ if (STRPREFIX (out, "/dev/mapper/") || STRPREFIX (out, "/dev/dm-")) {
+ char *canonical;
+ r = lv_canonical (out, &canonical);
+ if (r == -1) {
+ free (out);
+ return NULL;
+ }
+ if (r == 1) {
+ free (out);
+ out = canonical;
+ }
+ /* Ignore the case where r == 0. /dev/mapper does not correspond
+ * to an LV, so the best we can do is just return it as-is.
+ */
+ }
+
return out; /* caller frees */
}
return out; /* caller frees */
}