bug-gnulib
[Top][All Lists]
Advanced

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

Re: getcwd infinite recursion


From: Colin Watson
Subject: Re: getcwd infinite recursion
Date: Sun, 14 Oct 2007 21:29:09 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

On Sun, Oct 14, 2007 at 07:37:35PM +0100, Colin Watson wrote:
> On Sun, Oct 14, 2007 at 05:41:06PM +0200, Bruno Haible wrote:
> > The expected behaviour is that __getwcd expands to getcwd which in turns
> > expands to rpl_getcwd. If getcwd does not expand to rpl_getcwd, you need
> > to find out why. Look at the value of REPLACE_GETCWD in your config.status
> > and at the differences between lib/unistd.in.h (or lib/unistd_.h) and
> > lib/unistd.h.
> 
> REPLACE_GETCWD is 1 and unistd.h is up to date. However, getcwd.c
> includes <unistd.h>. Should this not be "unistd.h", in order to use the
> version from Gnulib in the current directory?
> 
> (I'm writing this mail in a brief interval between coming home and going
> out again, but I can try this out later if nobody beats me to it.)

I made this change and it now works correctly. It appears to be standard
practice in Gnulib to #include <unistd.h> using angle brackets, though,
so perhaps this needs to be checked across the board?

(Either that or Gnulib needs to put -I. in its AM_CPPFLAGS, since it
appears to define that variable to empty thus cancelling Automake's
default behaviour. Perhaps fixing that would be better than applying
this patch, though I don't know Gnulib nearly well enough to be sure!)

diff --git a/lib/getcwd.c b/lib/getcwd.c
index a185ef3..1dfda16 100644
--- a/lib/getcwd.c
+++ b/lib/getcwd.c
@@ -17,7 +17,7 @@
 
 #if !_LIBC
 # include <config.h>
-# include <unistd.h>
+# include "unistd.h"
 # include "dirfd.h"
 #endif
 
@@ -41,7 +41,7 @@
 # define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1)
 #endif
 
-#include <unistd.h>
+#include "unistd.h"
 #include <stdlib.h>
 #include <string.h>
 

Thanks,

-- 
Colin Watson                                       address@hidden




reply via email to

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