bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fchdir on mingw


From: Eric Blake
Subject: Re: fchdir on mingw
Date: Tue, 13 Oct 2009 15:34:36 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Blake <ebb9 <at> byu.net> writes:

> Date: Tue, 15 Sep 2009 15:54:43 -0600
> Subject: [PATCH] fchdir: improve use of replacement functions
> 
> * m4/fchdir.m4 (gl_FUNC_FCHDIR): Set appropriate witnesses.
> * m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Add REPLACE_FSTAT.

This patch broke fstat on non-directories on mingw, due to infinite recursion 
on the rpl_fstat definition (and it took me a month, and the addition of the 
utimens test, before I noticed it).  Fixing as follows:


From: Eric Blake <address@hidden>
Date: Tue, 13 Oct 2009 09:25:30 -0600
Subject: [PATCH] fchdir: avoid infinite recursion in mingw

* lib/fchdir.c (rpl_fstat): Call system fstat, rather than
recursing.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog    |    4 ++++
 lib/fchdir.c |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4bac820..6069410 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-10-13  Eric Blake  <address@hidden>

+       fchdir: avoid infinite recursion in mingw
+       * lib/fchdir.c (rpl_fstat): Call system fstat, rather than
+       recursing.
+
        test-stat-time: port to mingw
        * tests/test-stat-time.c (force_unlink): Return a value.
        (test_ctime) [W32]: Fix compilation error.
diff --git a/lib/fchdir.c b/lib/fchdir.c
index 19f02c3..16b17b4 100644
--- a/lib/fchdir.c
+++ b/lib/fchdir.c
@@ -217,6 +217,7 @@ _gl_directory_name (int fd)
    rpl_open() used a dummy file to work around an open() that can't
    normally visit directories.  */
 #if REPLACE_OPEN_DIRECTORY
+# undef fstat
 int
 rpl_fstat (int fd, struct stat *statbuf)
 {
-- 
1.6.4.2







reply via email to

[Prev in Thread] Current Thread [Next in Thread]