glib r7773 - trunk/gio
- From: matthiasc svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r7773 - trunk/gio
- Date: Mon, 5 Jan 2009 16:20:41 +0000 (UTC)
Author: matthiasc
Date: Mon Jan 5 16:20:40 2009
New Revision: 7773
URL: http://svn.gnome.org/viewvc/glib?rev=7773&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:
trunk/gio/ChangeLog
trunk/gio/glocalfileinfo.c
Modified: trunk/gio/glocalfileinfo.c
==============================================================================
--- trunk/gio/glocalfileinfo.c (original)
+++ trunk/gio/glocalfileinfo.c Mon Jan 5 16:20:40 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
@@ -1234,8 +1235,13 @@
sniff_length = _g_unix_content_type_get_sniff_len ();
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]