Re: [Tracker] [PATCH] tracker-files-utils.c: Handle only regular files.



Hi!,

Although this is an unlikely situation with most setups, I think it
makes sense. The patch has been just committed and pushed to master :)

Cheers,
  Carlos

On lun, 2009-11-30 at 13:39 +0100, Juan A. Suarez Romero wrote:
Do not handle 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 f58537a..68b609f 100644
--- a/src/libtracker-common/tracker-file-utils.c
+++ b/src/libtracker-common/tracker-file-utils.c
@@ -786,6 +786,7 @@ tracker_file_unlock (GFile *file)
 gboolean
 tracker_file_is_locked (GFile *file)
 {
+     GFileInfo *file_info;
      gboolean retval = FALSE;
      gchar *path;
      gint fd;
@@ -796,6 +797,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]