* 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.
This commit is contained in:
Christopher Faylor 2004-05-08 02:55:38 +00:00
parent f8aae275a4
commit ac3003157b
3 changed files with 14 additions and 11 deletions

View File

@ -1,3 +1,10 @@
2004-05-08 Pierre Humblet <pierre.humblet@ieee.org>
Christopher Faylor <cgf@timesys.com>
* 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 <corinna@vinschen.de> 2004-05-07 Corinna Vinschen <corinna@vinschen.de>
* fhandler_mem.cc (fhandler_dev_mem::fhandler_dev_mem): Move * fhandler_mem.cc (fhandler_dev_mem::fhandler_dev_mem): Move

View File

@ -54,7 +54,7 @@ static char **lastenviron;
CreateProcess. HOME is here because most shells use it and would be CreateProcess. HOME is here because most shells use it and would be
confused by Windows style path names. */ confused by Windows style path names. */
static int return_MAX_PATH (const char *) {return CYG_MAX_PATH;} 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, {NL ("PATH="), NULL, NULL, cygwin_win32_to_posix_path_list,
cygwin_posix_to_win32_path_list, cygwin_posix_to_win32_path_list,

View File

@ -61,6 +61,7 @@ details. */
#include "pwdgrp.h" #include "pwdgrp.h"
#include "cpuid.h" #include "cpuid.h"
#include "registry.h" #include "registry.h"
#include "environ.h"
#undef _close #undef _close
#undef _lseek #undef _lseek
@ -2232,21 +2233,16 @@ chroot (const char *newroot)
{ {
path_conv path (newroot, PC_SYM_FOLLOW | PC_FULL | PC_POSIX); path_conv path (newroot, PC_SYM_FOLLOW | PC_FULL | PC_POSIX);
int ret; int ret = -1;
if (path.error) if (path.error)
ret = -1; set_errno (path.error);
else if (!path.exists ()) else if (!path.exists ())
{ set_errno (ENOENT);
set_errno (ENOENT);
ret = -1;
}
else if (!path.isdir ()) else if (!path.isdir ())
{ set_errno (ENOTDIR);
set_errno (ENOTDIR);
ret = -1;
}
else else
{ {
getwinenv("PATH="); /* Save the native PATH */
cygheap->root.set (path.normalized_path, path); cygheap->root.set (path.normalized_path, path);
ret = 0; ret = 0;
} }