On Aug 18 15:19, Christopher Faylor wrote: > On Wed, Aug 18, 2010 at 09:13:40PM +0200, Corinna Vinschen wrote: > >I'm going to add a new call > > > > cygwin_internal (CW_SYNC_WINCWD); > > > >which will do the same for the CWD as > > > > cygwin_internal (CW_SYNC_WINENV); > > Actually I just checked in "CW_SETCWD" which just calls > SetCurrentDirectoryW. I was just going to request trying a snapshot > when I saw your message.
Oh. Shouldn't SetCurrentDirectoryW only be called if cygheap->cwd.get_error is 0? Here's what I had in mind: Index: external.cc =================================================================== RCS file: /cvs/src/src/winsup/cygwin/external.cc,v retrieving revision 1.116 diff -u -p -r1.116 external.cc --- external.cc 4 Jul 2010 17:12:26 -0000 1.116 +++ external.cc 18 Aug 2010 19:37:33 -0000 @@ -162,6 +162,24 @@ sync_winenv () free (envblock); } +/* Synchronize Win32 CWD with Cygwin CWD. Return -1 and set errno if + setting the Win32 CWD fails. */ +static unsigned long +sync_wincwd () +{ + if (cygheap->cwd.get_error ()) + { + set_errno (cygheap->cwd.get_error ()); + return (unsigned long) -1; + } + if (!SetCurrentDirectoryW (cygheap->cwd.win32.Buffer)) + { + __seterrno (); + return (unsigned long) -1; + } + return 0; +} + /* * Cygwin-specific wrapper for win32 ExitProcess and TerminateProcess. * It ensures that the correct exit code, derived from the specified @@ -514,6 +532,9 @@ cygwin_internal (cygwin_getinfo_types t, res = (uintptr_t) strerror (err); } break; + case CW_SYNC_WINCWD: + res = sync_wincwd (); + break; default: set_errno (ENOSYS); Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple