Date: Mon, 25 Jul 2011 00:17:20 +0000 (UTC) From: Maxim Sobolev <sobomax@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r224301 - stable/8/sys/geom/label Message-ID: <201107250017.p6P0HKTf030181@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sobomax Date: Mon Jul 25 00:17:20 2011 New Revision: 224301 URL: http://svn.freebsd.org/changeset/base/224301 Log: MFC: Strip any leading slashes before feeding the label to the geom_label code. Some linux distros put mount point into the ext2fs labels, such as '/', or '/boot', which confuses the devfs code and can cause userland programs to fail reading /dev/ext2fs directory with weird error code. Modified: stable/8/sys/geom/label/g_label_ext2fs.c Directory Properties: stable/8/sys/geom/label/ (props changed) Modified: stable/8/sys/geom/label/g_label_ext2fs.c ============================================================================== --- stable/8/sys/geom/label/g_label_ext2fs.c Sun Jul 24 23:44:16 2011 (r224300) +++ stable/8/sys/geom/label/g_label_ext2fs.c Mon Jul 25 00:17:20 2011 (r224301) @@ -53,6 +53,7 @@ g_label_ext2fs_taste(struct g_consumer * { struct g_provider *pp; e2sb_t *fs; + char *s_volume_name; g_topology_assert_not(); pp = cp->provider; @@ -74,13 +75,18 @@ g_label_ext2fs_taste(struct g_consumer * goto exit_free; } + s_volume_name = fs->s_volume_name; + /* Terminate label */ + s_volume_name[sizeof(fs->s_volume_name) - 1] = '\0'; + + if (s_volume_name[0] == '/') + s_volume_name += 1; + /* Check for volume label */ - if (fs->s_volume_name[0] == '\0') + if (s_volume_name[0] == '\0') goto exit_free; - /* Terminate label */ - fs->s_volume_name[sizeof(fs->s_volume_name) - 1] = '\0'; - strlcpy(label, fs->s_volume_name, size); + strlcpy(label, s_volume_name, size); exit_free: g_free(fs);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107250017.p6P0HKTf030181>