diff --git a/ChangeLog b/ChangeLog index 8973608..f700087 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/src/device-info.c b/src/device-info.c index 52220c5..605039a 100644 --- a/src/device-info.c +++ b/src/device-info.c @@ -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' )