From: Richard W.M. Jones Date: Tue, 16 Nov 2010 15:56:11 +0000 (+0000) Subject: daemon: findfs-uuid and findfs-label should not return /dev/mapper paths. X-Git-Tag: 1.6.2~8 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=a9028a4fe69056e391b05704ef69bf586499901d;p=libguestfs.git daemon: findfs-uuid and findfs-label should not return /dev/mapper paths. (cherry picked from commit 2bfeaeaa308adf27853c1ec6d1d958a3e4734b8e) --- diff --git a/daemon/findfs.c b/daemon/findfs.c index 0520f18..061ab0a 100644 --- 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 (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 */ }