Eric Blake wrote: > save-cwd needs either a working fchdir or a working getcwd(NULL). > The only platform where getcwd fixes problems not solved by > getcwd-lgpl is Linux, but fchdir works there. > > * modules/save-cwd (Depends-on): Use getcwd-lgpl. > > Signed-off-by: Eric Blake <ebl...@redhat.com> > --- > ChangeLog | 3 +++ > modules/save-cwd | 2 +- > 2 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/ChangeLog b/ChangeLog > index 1416cf6..8603b51 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,5 +1,8 @@ > 2011-04-26 Eric Blake <ebl...@redhat.com> > > + save-cwd: reduce dependency > + * modules/save-cwd (Depends-on): Use getcwd-lgpl. > + > getcwd: enhance tests > * tests/test-getcwd-lgpl.c: New file, taken from... > * tests/test-getcwd.c: ...old contents. Rewrite this file to > diff --git a/modules/save-cwd b/modules/save-cwd ... > -getcwd > +getcwd-lgpl
Hi Eric, Unfortunately, that change would introduce a bug. save_cwd's open (".", O_SEARCH) may fail in a directory where getcwd's function would succeed, while getcwd-lgpl's would not. Thus, we have to use the robust getcwd module there. Try calling save_cwd from an unreadable yet accessible directory whose absolute name is too long for getcwd-lgpl. This condition will persist as long as we have to worry about O_SEARCH being defined to O_RDONLY.