mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
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
This commit is contained in:
parent
b9cf1ed275
commit
a836486e24
@ -1,3 +1,10 @@
|
||||
2009-01-05 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
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 <desrt@desrt.ca>
|
||||
|
||||
* tests/.gitignore: improve
|
||||
|
@ -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 @@ 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;
|
||||
|
Loading…
Reference in New Issue
Block a user