https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=4c9bb3e0f934babda5aea0712a70a893f93cff4b
commit 4c9bb3e0f934babda5aea0712a70a893f93cff4b Author: Corinna Vinschen <cori...@vinschen.de> Date: Thu Mar 17 17:46:11 2016 +0100 Propagate correct Windows error if executable can't be opened * spawn.cc (av::setup): Set last Win32 error if NtOpenFile fails. Signed-off-by: Corinna Vinschen <cori...@vinschen.de> Diff: --- winsup/cygwin/spawn.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 1cc5cf3..a2111c2 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -1085,6 +1085,7 @@ av::setup (const char *prog_arg, path_conv& real_path, const char *ext, real_path.set_cygexec (true); break; } + SetLastError (RtlNtStatusToDosError (status)); goto err; } if (!GetFileSizeEx (h, &size))