1.7.5: Occasional failure of CreatePipe or signal handing due to thread-unsafe code in cwdstuff::set

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Aug 12 19:17:00 GMT 2010


On Aug 12 15:09, Christopher Faylor wrote:
> On Thu, Aug 12, 2010 at 08:42:43PM +0200, Corinna Vinschen wrote:
> >+	  /* When inited move the actual Win32 CWD out of the way, as explained
> >+	     above.  Surprisingly, the PIPE filesystem seems to be usable as CWD
> >+	     on all Windows systems. */
> >+	  if (!SetCurrentDirectoryW (L"\\\\?\\PIPE\\"))
> >+	    small_printf (
> 
> Shouldn't this be system_printf?  Otherwise it won't show up in an strace.

Ok, right.

> And, why not just use %E rather than calling GetLastError() directly?

hand->slap->forehead

> >+  if (!real_path.iscygexec () && cygheap->cwd.get_error () != 0)
> >     {
> >-      small_printf ("Error: Current working directory is a %s.\n"
> >+      const char *reason;
> >+      switch (cygheap->cwd.get_error ())
> >+	{
> >+	case EACCES:
> >+	  reason = "has restricted permissions which render it\n"
> >+		   "inaccessible as Win32 working directory";
> >+	  break;
> >+	case ENOENT:
> >+	  reason = "is a virtual Cygwin directory";
> >+	  break;
> >+	case ENAMETOOLONG:
> >+	  reason = "has a path longer than allowed for a\n"
> >+		   "Win32 working directory";
> >+	  break;
> >+	default:
> >+	  reason = "is not accessible for some reason (shouldn't happen!)";
> >+	  break;
> 
> A small nit but rather than put the knowledge for what these error codes
> mean in spawn_guts shouldn't it be coming a from cwd.strerror() or
> something like that?

Good point.  I'll see to it.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat



More information about the Cygwin-developers mailing list