svn commit: r224301 - stable/8/sys/geom/label
Maxim Sobolev
sobomax at FreeBSD.org
Mon Jul 25 00:17:21 UTC 2011
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);
More information about the svn-src-stable
mailing list