btrfs moint point detection workaround - spacefm issue 165

This commit is contained in:
IgnorantGuru 2012-10-07 08:16:16 -06:00
parent 5d77780cae
commit d324b07c7d
2 changed files with 47 additions and 5 deletions

View File

@ -1,5 +1,5 @@
0.3.3+
btrfs moint point detection workaround - spacefm issue 165
0.3.3 2012-09-14:
update ru.po
no quote cifs password

View File

@ -917,12 +917,54 @@ gchar* info_mount_points( device_t *device, GList* devmounts )
continue;
}
if ( major != dmajor || minor != dminor )
/* ignore mounts where only a subtree of a filesystem is mounted */
if (g_strcmp0 (encoded_root, "/") != 0)
continue;
/* ignore mounts where only a subtree of a filesystem is mounted */
if (g_strcmp0 (encoded_root, "/") != 0)
continue;
/* Temporary work-around for btrfs, see
*
* https://github.com/IgnorantGuru/spacefm/issues/165
* http://article.gmane.org/gmane.comp.file-systems.btrfs/2851
* https://bugzilla.redhat.com/show_bug.cgi?id=495152#c31
*/
if ( major == 0 )
{
const gchar *sep;
sep = strstr( lines[n], " - " );
if ( sep != NULL )
{
gchar typebuf[PATH_MAX];
gchar mount_source[PATH_MAX];
struct stat statbuf;
if (sscanf (sep + 3, "%s %s", typebuf, mount_source) != 2)
{
g_warning ("Error parsing things past - for '%s'", lines[n]);
continue;
}
if (g_strcmp0 (typebuf, "btrfs") != 0)
continue;
if (!g_str_has_prefix (mount_source, "/dev/"))
continue;
if (stat (mount_source, &statbuf) != 0)
{
g_warning ("Error statting %s: %m", mount_source);
continue;
}
if (!S_ISBLK (statbuf.st_mode))
{
g_warning ("%s is not a block device", mount_source);
continue;
}
major = major( statbuf.st_rdev );
minor = minor( statbuf.st_rdev );
}
else
continue;
}
if ( major != dmajor || minor != dminor )
continue;
mount_point = g_strcompress (encoded_mount_point);
if ( mount_point && mount_point[0] != '\0' )