summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/syscalls.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc16
1 files changed, 6 insertions, 10 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 305d0f0f8..af2974413 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -61,6 +61,7 @@ details. */
#include "pwdgrp.h"
#include "cpuid.h"
#include "registry.h"
+#include "environ.h"
#undef _close
#undef _lseek
@@ -2232,21 +2233,16 @@ chroot (const char *newroot)
{
path_conv path (newroot, PC_SYM_FOLLOW | PC_FULL | PC_POSIX);
- int ret;
+ int ret = -1;
if (path.error)
- ret = -1;
+ set_errno (path.error);
else if (!path.exists ())
- {
- set_errno (ENOENT);
- ret = -1;
- }
+ set_errno (ENOENT);
else if (!path.isdir ())
- {
- set_errno (ENOTDIR);
- ret = -1;
- }
+ set_errno (ENOTDIR);
else
{
+ getwinenv("PATH="); /* Save the native PATH */
cygheap->root.set (path.normalized_path, path);
ret = 0;
}