X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Wed, 18 Aug 2010 21:38:10 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: "run" changes behavior with cygwin-17.6 Message-ID: <20100818193810.GD11340@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <380-220108318145158645 AT cantv DOT net> <20100818150920 DOT GY11340 AT calimero DOT vinschen DOT de> <4C6C1490 DOT 3040202 AT cwilson DOT fastmail DOT fm> <4C6C1582 DOT 1080801 AT acm DOT org> <20100818182412 DOT GA22698 AT ednor DOT casa DOT cgf DOT cx> <20100818185421 DOT GC22698 AT ednor DOT casa DOT cgf DOT cx> <20100818191340 DOT GB11340 AT calimero DOT vinschen DOT de> <20100818191906 DOT GD22698 AT ednor DOT casa DOT cgf DOT cx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20100818191906.GD22698@ednor.casa.cgf.cx> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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