From: Matthias Clasen Date: Mon, 5 Jan 2009 16:20:40 +0000 (+0000) Subject: Try using O_NOATIME when sniffing for mime types. Based on a patch by A. X-Git-Tag: GLIB_2_19_4~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a836486e24780616579ab0f8ef657a2a78960183;p=platform%2Fupstream%2Fglib.git Try using O_NOATIME when sniffing for mime types. Based on a patch by A. * glocalfileinfo.c (get_content_type): Try using O_NOATIME when sniffing for mime types. Based on a patch by A. Walton svn path=/trunk/; revision=7773 --- diff --git a/gio/ChangeLog b/gio/ChangeLog index 6736067..43ed5e4 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,3 +1,10 @@ +2009-01-05 Matthias Clasen + + Bug 566064 – Add NOATIME flag to query_info_flags + + * glocalfileinfo.c (get_content_type): Try using O_NOATIME when + sniffing for mime types. Based on a patch by A. Walton + 2009-01-05 Ryan Lortie * tests/.gitignore: improve diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c index 60d4686..299fc2d 100644 --- a/gio/glocalfileinfo.c +++ b/gio/glocalfileinfo.c @@ -33,6 +33,7 @@ #ifdef HAVE_UNISTD_H #include #endif +#define _GNU_SOURCE #include #include #ifdef HAVE_GRP_H @@ -1234,8 +1235,13 @@ get_content_type (const char *basename, 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;