Re: Recent checkins to lib/xgetcwd.c breaks Windows
Jim Hyslop <[EMAIL PROTECTED]> wrote: > The recent checkin to lib/xgetcwd.c changes the implementation of > xgetwd() from: ... > to: > > char * > xgetcwd (void) > { > char *cwd = getcwd (NULL, 0); > if (! cwd && errno == ENOMEM) > xalloc_die (); > return cwd; > } > > While the new version is shorter, it doesn't work on Windows (Cygwin). > It appears that Cygwin expects the parameter to getcwd() to be non-NULL. > At least, 'getcwd()' always returns in the latest version of the file > (trunk). Can we revert xgetcwd.c to its previous version? Why was it > changed? Hi Jim, The new version relies on a configure-time check (m4/getcwd.m4) and on the lib/getcwd.c replacement function, on systems that don't work the way the above code requires. Is there a problem with one of those? It sounds like you should find this definition #define __GETCWD_PREFIX rpl_ in config.h on a Cygwin system. Similarly, building should compile lib/getcwd.c, which should define rpl_getcwd. ___ Bug-cvs mailing list Bug-cvs@gnu.org http://lists.gnu.org/mailman/listinfo/bug-cvs
Recent checkins to lib/xgetcwd.c breaks Windows
The recent checkin to lib/xgetcwd.c changes the implementation of xgetwd() from: char * xgetwd () { char *cwd; char *ret; unsigned path_max; errno = 0; path_max = (unsigned) PATH_MAX; path_max += 2;/* The getcwd docs say to do this. */ cwd = xmalloc (path_max); errno = 0; while ((ret = getcwd (cwd, path_max)) == NULL && errno == ERANGE) { path_max += PATH_INCR; cwd = xrealloc (cwd, path_max); errno = 0; } if (ret == NULL) { int save_errno = errno; free (cwd); errno = save_errno; return NULL; } return cwd; } to: char * xgetcwd (void) { char *cwd = getcwd (NULL, 0); if (! cwd && errno == ENOMEM) xalloc_die (); return cwd; } While the new version is shorter, it doesn't work on Windows (Cygwin). It appears that Cygwin expects the parameter to getcwd() to be non-NULL. At least, 'getcwd()' always returns in the latest version of the file (trunk). Can we revert xgetcwd.c to its previous version? Why was it changed? -- Jim ___ Bug-cvs mailing list Bug-cvs@gnu.org http://lists.gnu.org/mailman/listinfo/bug-cvs