diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index c8cc30a1c..325c01f56 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2004-05-08 Pierre Humblet + Christopher Faylor + + * syscalls.cc: Include environ.h. + (chroot): Set errno in case of path error. Call getwinenv. + * environ.cc: Remove the NO_COPY attribute of conv_envvars. + 2004-05-07 Corinna Vinschen * fhandler_mem.cc (fhandler_dev_mem::fhandler_dev_mem): Move diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index fd04e1fcc..749d8139f 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -54,7 +54,7 @@ static char **lastenviron; CreateProcess. HOME is here because most shells use it and would be confused by Windows style path names. */ static int return_MAX_PATH (const char *) {return CYG_MAX_PATH;} -static NO_COPY win_env conv_envvars[] = +static win_env conv_envvars[] = { {NL ("PATH="), NULL, NULL, cygwin_win32_to_posix_path_list, cygwin_posix_to_win32_path_list, 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; }