X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=inline;f=lib%2Ffts.c;h=7210c1bbb9689dfe163826e0aa821778bdf3edc1;hb=c3de829c6f94be07b6104c5403d070791fc516fb;hp=2c1e0ecdc18f99591fd0a70e5361fa3358b12c60;hpb=93785052e7a8c1ca5f263a39c3e77286f487e22d;p=gnulib.git diff --git a/lib/fts.c b/lib/fts.c index 2c1e0ecdc..7210c1bbb 100644 --- a/lib/fts.c +++ b/lib/fts.c @@ -1,6 +1,6 @@ /* Traverse a file hierarchy. - Copyright (C) 2004-2010 Free Software Foundation, Inc. + Copyright (C) 2004-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -349,7 +349,8 @@ internal_function diropen (FTS const *sp, char const *dir) { int open_flags = (O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK - | (ISSET (FTS_PHYSICAL) ? O_NOFOLLOW : 0)); + | (ISSET (FTS_PHYSICAL) ? O_NOFOLLOW : 0) + | (ISSET (FTS_NOATIME) ? O_NOATIME : 0)); int fd = (ISSET (FTS_CWDFD) ? openat (sp->fts_cwd_fd, dir, open_flags) @@ -406,7 +407,8 @@ fts_open (char * const *argv, early, doing it here saves us the trouble of ensuring later (where it'd be messier) that "." can in fact be opened. If not, revert to FTS_NOCHDIR mode. */ - int fd = open (".", O_SEARCH); + int fd = open (".", + O_SEARCH | (ISSET (FTS_NOATIME) ? O_NOATIME : 0)); if (fd < 0) { /* Even if `.' is unreadable, don't revert to FTS_NOCHDIR mode @@ -628,7 +630,7 @@ fts_close (FTS *sp) #if defined __linux__ \ && HAVE_SYS_VFS_H && HAVE_FSTATFS && HAVE_STRUCT_STATFS_F_TYPE -#include +# include /* Linux-specific constants from coreutils' src/fs.h */ # define S_MAGIC_TMPFS 0x1021994 @@ -710,7 +712,7 @@ leaf_optimization_applies (int dir_fd _GL_UNUSED) { return false; } #endif /* link-count-optimization entry: - map an stat.st_dev number to a boolean: leaf_optimization_works */ + map a stat.st_dev number to a boolean: leaf_optimization_works */ struct LCO_ent { dev_t st_dev; @@ -1241,10 +1243,11 @@ fts_build (register FTS *sp, int type) opendirat((! ISSET(FTS_NOCHDIR) && ISSET(FTS_CWDFD) \ ? sp->fts_cwd_fd : AT_FDCWD), \ file, \ - ((ISSET(FTS_PHYSICAL) \ - && ! (ISSET(FTS_COMFOLLOW) \ - && cur->fts_level == FTS_ROOTLEVEL)) \ - ? O_NOFOLLOW : 0), \ + (((ISSET(FTS_PHYSICAL) \ + && ! (ISSET(FTS_COMFOLLOW) \ + && cur->fts_level == FTS_ROOTLEVEL)) \ + ? O_NOFOLLOW : 0) \ + | (ISSET (FTS_NOATIME) ? O_NOATIME : 0)), \ &dir_fd) #endif if ((dirp = __opendir2(cur->fts_accpath, oflag)) == NULL) { @@ -1653,7 +1656,7 @@ fd_ring_check (FTS const *sp) int fd = i_ring_pop (&fd_w); if (0 <= fd) { - int parent_fd = openat (cwd_fd, "..", O_SEARCH); + int parent_fd = openat (cwd_fd, "..", O_SEARCH | O_NOATIME); if (parent_fd < 0) { // Warn?