[tracker] Do not check locks on special files like pipes or sockets.
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker] Do not check locks on special files like pipes or sockets.
- Date: Mon, 1 Feb 2010 10:28:02 +0000 (UTC)
commit f67eec357caf14185d4bbeead0babbf6e9f68b45
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Mon Feb 1 11:26:25 2010 +0100
Do not check locks on special files like pipes or sockets.
This avoids blocking when opening such kind of files.
src/libtracker-common/tracker-file-utils.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-common/tracker-file-utils.c b/src/libtracker-common/tracker-file-utils.c
index 843ac5e..e2650ac 100644
--- a/src/libtracker-common/tracker-file-utils.c
+++ b/src/libtracker-common/tracker-file-utils.c
@@ -791,6 +791,7 @@ tracker_file_unlock (GFile *file)
gboolean
tracker_file_is_locked (GFile *file)
{
+ GFileInfo *file_info;
gboolean retval = FALSE;
gchar *path;
gint fd;
@@ -801,6 +802,24 @@ tracker_file_is_locked (GFile *file)
return FALSE;
}
+ /* Handle regular files; skip pipes and alike */
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ NULL);
+
+ if (!file_info) {
+ return FALSE;
+ }
+
+ if (g_file_info_get_file_type (file_info) != G_FILE_TYPE_REGULAR) {
+ g_object_unref (file_info);
+ return FALSE;
+ }
+
+ g_object_unref (file_info);
+
path = g_file_get_path (file);
if (!path) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]