[Xfce4-commits] <thunar:master> Fix freeze on /proc/kmsg.
Nick Schermer
noreply at xfce.org
Sat Dec 15 13:48:01 CET 2012
Updating branch refs/heads/master
to 999a4de29e36a80cacdae2acaa809ef9acd2dcb8 (commit)
from 6473fa8a6394abf7df389d0e28a07bad827f7aa7 (commit)
commit 999a4de29e36a80cacdae2acaa809ef9acd2dcb8
Author: Nick Schermer <nick at xfce.org>
Date: Sat Dec 15 13:45:59 2012 +0100
Fix freeze on /proc/kmsg.
thunar/thunar-file.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 484ba23..0878817 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -136,6 +136,8 @@ static guint file_signals[LAST_SIGNAL];
#define FLAG_UNSET(file,flag) G_STMT_START{ ((file)->flags &= ~(flag)); }G_STMT_END
#define FLAG_IS_SET(file,flag) (((file)->flags & (flag)) != 0)
+#define DEFAULT_CONTENT_TYPE "application/octet-stream"
+
typedef enum
@@ -827,6 +829,7 @@ thunar_file_info_reload (ThunarFile *file,
const gchar *display_name;
gboolean is_secure = FALSE;
gchar *casefold;
+ gchar *path;
_thunar_return_if_fail (THUNAR_IS_FILE (file));
_thunar_return_if_fail (file->info == NULL || G_IS_FILE_INFO (file->info));
@@ -851,6 +854,16 @@ thunar_file_info_reload (ThunarFile *file,
file->basename = g_file_get_basename (file->gfile);
_thunar_assert (file->basename != NULL);
+ /* problematic files with content type reading */
+ if (strcmp (file->basename, "kmsg") == 0
+ && g_file_is_native (file->gfile))
+ {
+ path = g_file_get_path (file->gfile);
+ if (g_strcmp0 (path, "/proc/kmsg") == 0)
+ file->content_type = g_strdup (DEFAULT_CONTENT_TYPE);
+ g_free (path);
+ }
+
/* check if this file is a desktop entry */
if (thunar_file_is_desktop_file (file, &is_secure) && is_secure)
{
@@ -2257,9 +2270,7 @@ thunar_file_get_content_type (ThunarFile *file)
{
/* async load the content-type */
info = g_file_query_info (file->gfile,
- thunar_file_is_readable (file) ?
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE :
- G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
G_FILE_QUERY_INFO_NONE,
NULL, &err);
@@ -2281,7 +2292,7 @@ thunar_file_get_content_type (ThunarFile *file)
/* always provide a fallback */
if (file->content_type == NULL)
- file->content_type = g_strdup ("application/octet-stream");
+ file->content_type = g_strdup (DEFAULT_CONTENT_TYPE);
}
bailout:
More information about the Xfce4-commits
mailing list