diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2010-11-16 15:56:11 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2010-11-16 15:56:54 +0000 |
commit | 2bfeaeaa308adf27853c1ec6d1d958a3e4734b8e (patch) | |
tree | c2cfb869d25c888e3106cdb87305f22117f9d68e | |
parent | fab75c0337d7897d10ea5e95e47ac05eab81ace9 (diff) | |
download | libguestfs-2bfeaeaa308adf27853c1ec6d1d958a3e4734b8e.tar.gz libguestfs-2bfeaeaa308adf27853c1ec6d1d958a3e4734b8e.tar.xz libguestfs-2bfeaeaa308adf27853c1ec6d1d958a3e4734b8e.zip |
daemon: findfs-uuid and findfs-label should not return /dev/mapper paths.
-rw-r--r-- | daemon/findfs.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/daemon/findfs.c b/daemon/findfs.c index 0520f181..061ab0a4 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 */ } |