*
* 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 <config.h>
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 */
}