$OpenBSD: patch-src_libtracker-common_tracker-file-utils_c,v 1.4 2012/02/02 07:12:23 ajacoutot Exp $

From a6ae1d90385b7eb9c4a5bd6a9ca17eb32b666b04 Mon Sep 17 00:00:00 2001
From: Antoine Jacoutot <ajacoutot@openbsd.org>
Date: Tue, 10 Jan 2012 11:45:29 +0000
Subject: libtracker-common: Add new function tracker_file_open_fd()

--- src/libtracker-common/tracker-file-utils.c.orig	Fri Dec 16 17:08:04 2011
+++ src/libtracker-common/tracker-file-utils.c	Mon Jan 30 17:34:23 2012
@@ -50,22 +50,34 @@
 
 static GHashTable *file_locks = NULL;
 
-FILE *
-tracker_file_open (const gchar *path)
+int
+tracker_file_open_fd (const gchar *path)
 {
-	FILE *file;
 	int fd;
 
-	g_return_val_if_fail (path != NULL, NULL);
+	g_return_val_if_fail (path != NULL, -1);
 
 #if defined(__linux__)
-	fd = g_open (path, O_RDONLY | O_NOATIME);
+	fd = g_open (path, O_RDONLY | O_NOATIME, 0);
 	if (fd == -1 && errno == EPERM) {
-		fd = g_open (path, O_RDONLY);
+		fd = g_open (path, O_RDONLY, 0);
 	}
 #else
-	fd = g_open (path, O_RDONLY);
+	fd = g_open (path, O_RDONLY, 0);
 #endif
+
+	return fd;
+}
+
+FILE *
+tracker_file_open (const gchar *path)
+{
+	FILE *file;
+	int fd;
+
+	g_return_val_if_fail (path != NULL, NULL);
+
+	fd = tracker_file_open_fd (path);
 
 	if (fd == -1) {
 		return NULL;
