glib r7791 - branches/glib-2-18/gio



Author: matthiasc
Date: Fri Jan  9 06:14:41 2009
New Revision: 7791
URL: http://svn.gnome.org/viewvc/glib?rev=7791&view=rev

Log:
       * glocalfileinfo.c (get_content_type): Try using O_NOATIME when
        sniffing for mime types. Based on a patch by A. Walton



Modified:
   branches/glib-2-18/gio/ChangeLog
   branches/glib-2-18/gio/glocalfileinfo.c

Modified: branches/glib-2-18/gio/glocalfileinfo.c
==============================================================================
--- branches/glib-2-18/gio/glocalfileinfo.c	(original)
+++ branches/glib-2-18/gio/glocalfileinfo.c	Fri Jan  9 06:14:41 2009
@@ -33,6 +33,7 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#define _GNU_SOURCE
 #include <fcntl.h>
 #include <errno.h>
 #ifdef HAVE_GRP_H
@@ -1235,7 +1236,11 @@
 	  if (sniff_length > 4096)
 	    sniff_length = 4096;
 	  
-	  fd = open (path, O_RDONLY);
+#ifdef O_NOATIME
+          fd = open (path, O_RDONLY | O_NOATIME);
+          if (fd < 0 && errno == EPERM)
+#endif
+	    fd = open (path, O_RDONLY);
 	  if (fd != -1)
 	    {
 	      ssize_t res;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]