From 30d7dcd93ecccaf961183a43a5b900449cf36bcb Mon Sep 17 00:00:00 2001
From: Brian Tarricone <brian@tarricone.org>
Date: Wed, 29 Oct 2008 03:56:13 +0000
Subject: [PATCH] =?UTF-8?q?=09*=20thunar-vfs/thunar-vfs-mime-database.c:?=
 =?UTF-8?q?=20Fix=20usage=20of=20=09=20=20fgetxattr()=20on=20MacOS=20X.=20?=
 =?UTF-8?q?=20Patch=20from=20Anders=20Bj=C3=B6rklund=20=09=20=20<afb@users?=
 =?UTF-8?q?.sourceforge.net>=20(bug=204433).?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

(Old svn revision: 28496)
---
 ChangeLog                             | 18 ++++++++++++------
 thunar-vfs/thunar-vfs-mime-database.c |  9 +++++++++
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b41b3de12..18678df8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-28	Brian Tarricone <kelnos@xfce.org>
+
+	* thunar-vfs/thunar-vfs-mime-database.c: Fix usage of
+	  fgetxattr() on MacOS X.  Patch from Anders Björklund
+	  <afb@users.sourceforge.net> (bug 4433).
+
 2008-10-25  Stephan Arts <stephan@xfce.org>
 
 	* plugins/thunar-wallpaper:
@@ -67,13 +73,13 @@
 	  Make sure to pass the correct $DISPLAY value to processes
 	  spawned by Thunar and xfdesktop. Bug #3667.
 
-2007-08-24	Jean-François Wauthy <pollux@xfce.org>
+2007-08-24	Jean-François Wauthy <pollux@xfce.org>
 
 	* docs/manual/fr/Thunar.xml.in: minor corrections in French
 	translation of the manual (patch by Adrien Grellier
 	<adrien.grellier@laposte.net>)
 
-2007-08-23	Jean-François Wauthy <pollux@xfce.org>
+2007-08-23	Jean-François Wauthy <pollux@xfce.org>
 
 	* docs/manual/pl/images/file-manager-window.png,
 	docs/manual/pl/images/preferences-views.png,
@@ -251,7 +257,7 @@
 
 	* po-doc/*.po: Regenerate the translations.
 	* docs/manual/pl/Thunar.xml.in, po-doc/pl.po: Updated the polish
-	  translations of the user manual by Szymon Ka¿asz
+	  translations of the user manual by Szymon Kałasz
 	  <szymon_maestro@gazeta.pl>.
 
 2007-01-20	Benedikt Meurer <benny@xfce.org>
@@ -1676,7 +1682,7 @@
 2006-04-17	Benedikt Meurer <benny@xfce.org>
 
 	* docs/manual/es/Thunar.xml.in, po-doc/es.po: Update spanish
-	  translations by José M <josem88@gmail.com>.
+	  translations by José M <josem88@gmail.com>.
 
 2006-04-16	Benedikt Meurer <benny@xfce.org>
 
@@ -2806,7 +2812,7 @@
 	  keyboard shortcuts and people can customize these shortcuts using
 	  the standard GtkBindingSet mechanism. Bug #1380.
 	* po/Thunar.pot, po/*.po: Update translations.
-	* po/de.po: "Gerät auswerfen" is probably not the best translation
+	* po/de.po: "Gerät auswerfen" is probably not the best translation
 	  for "Eject Volume". ;-)
 	* po/de.po: Even more love for the german translation.
 
@@ -4750,7 +4756,7 @@
 2005-10-03	Benedikt Meurer <benny@xfce.org>
 
 	* THANKS, configure.in.in, po/es.po: Add spanish translations, thanks
-	  to Pablo Hernández-M. Saiz <homeless3d@gmail.com>.
+	  to Pablo Hernández-M. Saiz <homeless3d@gmail.com>.
 
 2005-10-02	Benedikt Meurer <benny@xfce.org>
 
diff --git a/thunar-vfs/thunar-vfs-mime-database.c b/thunar-vfs/thunar-vfs-mime-database.c
index 865195f87..686485ba0 100644
--- a/thunar-vfs/thunar-vfs-mime-database.c
+++ b/thunar-vfs/thunar-vfs-mime-database.c
@@ -1122,11 +1122,20 @@ thunar_vfs_mime_database_get_info_for_file (ThunarVfsMimeDatabase *database,
             }
 #elif defined(HAVE_FGETXATTR)
           /* check for valid mime type stored in the extattr (Linux) */
+#if defined(__APPLE__) && defined(__MACH__)
+          nbytes = fgetxattr (fd, "user.mime_type", NULL, 0, 0, 0);
+#else
           nbytes = fgetxattr (fd, "user.mime_type", NULL, 0);
+#endif
           if (G_UNLIKELY (nbytes >= 3))
             {
               buffer = g_newa (gchar, nbytes + 1);
+#if defined(__APPLE__) && defined(__MACH__)
+              nbytes = fgetxattr (fd, "user.mime_type", buffer, nbytes, 0, 0);
+#else
               nbytes = fgetxattr (fd, "user.mime_type", buffer, nbytes);
+#endif
+
               if (G_LIKELY (nbytes >= 3))
                 {
                   buffer[nbytes] = '\0';
-- 
GitLab