X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Ffindfs.c;h=2c624b67fecd5e32cb012cbe5b0f60e5c8d99b4e;hb=e1f395defc6db5bbc82537af6e517d94216b7d4b;hp=0520f181fc66f0bc6e66bfac270d5e06329bed81;hpb=65e9ac4595fbace8f301030469932be518456246;p=libguestfs.git diff --git a/daemon/findfs.c b/daemon/findfs.c index 0520f18..2c624b6 100644 --- a/daemon/findfs.c +++ b/daemon/findfs.c @@ -13,7 +13,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include @@ -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 */ }