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:
Matthias Clasen 2009-01-05 16:20:40 +00:00
parent b9cf1ed275
commit a836486e24
2 changed files with 15 additions and 2 deletions

View File

@ -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> 2009-01-05 Ryan Lortie <desrt@desrt.ca>
* tests/.gitignore: improve * tests/.gitignore: improve

View File

@ -33,6 +33,7 @@
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#define _GNU_SOURCE
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#ifdef HAVE_GRP_H #ifdef HAVE_GRP_H
@ -1235,7 +1236,12 @@ get_content_type (const char *basename,
if (sniff_length > 4096) if (sniff_length > 4096)
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) if (fd != -1)
{ {
ssize_t res; ssize_t res;