* winsup.h (NT_MAX_PATH): Revert ill-advised change to 32767.
Accommodate change throughout. * cygwin.din (cygwin_conv_path): Export. (cygwin_conv_path_list): Export. (cygwin_create_path): Export. * dcrt0.cc (dll_crt0_1): Use cygwin_conv_path. * dtable.cc (handle_to_fn): Ditto. Don't expect UNICODE_STRING being 0-terminated. * environ.cc (env_plist_to_posix): New helper function. (env_plist_to_win32): Ditto. (env_path_to_posix): Ditto. (env_path_to_win32): Ditto. (return_MAX_PATH): Remove. (conv_envvars): Use new helper functions. Drop removed members. (win_env::operator =): Accommodate removal of path length functions. (win_env::add_cache): Accommodate new env helper function API. (posify): Ditto. * environ.h (struct win_env): Ditto. Remove path length function pointers since they are unused. * path.cc (warn_msdos): Use cygwin_conv_path. (getfileattr): Use new tmp_pathbuf::u_get method. (fillout_mntent): Ditto. (symlink_info::check): Ditto. (path_conv::check): Use sizeof (WCHAR) instead of constant 2. (symlink_info::check_reparse_point): Ditto. (conv_path_list): Get max size of target string as argument. Call cygwin_conv_path as helper function. (cygwin_conv_path): New function. (cygwin_create_path): New function. (cygwin_conv_to_win32_path): Just call cygwin_conv_path with size set to MAX_PATH. (cygwin_conv_to_full_win32_path): Ditto. (cygwin_conv_to_posix_path): Ditto. (cygwin_conv_to_full_posix_path): Ditto. (conv_path_list_buf_size): Add FIXME comment. (env_PATH_to_posix): Rename from env_win32_to_posix_path_list. Add size argument as required for env helper functions. (cygwin_win32_to_posix_path_list): Call conv_path_list with size set to MAX_PATH. (cygwin_posix_to_win32_path_list): Ditto. (cygwin_conv_path_list): New function. (cwdstuff::get): Fix length argument in call to sys_wcstombs. * spawn.cc (find_exec): Use cygwin_conv_path_list. * tls_pbuf.h (tmp_pathbuf::u_get: New method. * uinfo.cc (cygheap_user::ontherange): Allocate temporary path buffers using tmp_pathbuf. Use cygwin_conv_path. * winf.cc (av::unshift): Use cygwin_conv_path. * include/cygwin/version.h: Bump API minor number. * include/sys/cygwin.h: Comment out old cygwin32_XXX API. Mark old path handling API as deprecated. (cygwin_conv_path_t): Typedef. Define values. (cygwin_conv_path): Declare. (cygwin_create_path): Declare. (cygwin_conv_path_list): Declare.
This commit is contained in:
@ -30,6 +30,7 @@ details. */
|
||||
#include "child_info.h"
|
||||
#include "environ.h"
|
||||
#include "pwdgrp.h"
|
||||
#include "tls_pbuf.h"
|
||||
#include "ntdll.h"
|
||||
|
||||
/* Initialize the part of cygheap_user that does not depend on files.
|
||||
@ -240,11 +241,10 @@ cygheap_user::ontherange (homebodies what, struct passwd *pw)
|
||||
LPUSER_INFO_3 ui = NULL;
|
||||
WCHAR wuser[UNLEN + 1];
|
||||
NET_API_STATUS ret;
|
||||
char homepath_env_buf[CYG_MAX_PATH];
|
||||
char homedrive_env_buf[3];
|
||||
char *newhomedrive = NULL;
|
||||
char *newhomepath = NULL;
|
||||
|
||||
tmp_pathbuf tp;
|
||||
|
||||
debug_printf ("what %d, pw %p", what, pw);
|
||||
if (what == CH_HOME)
|
||||
@ -273,11 +273,12 @@ cygheap_user::ontherange (homebodies what, struct passwd *pw)
|
||||
setenv ("HOME", "/", 1);
|
||||
else
|
||||
{
|
||||
char home[CYG_MAX_PATH];
|
||||
char buf[CYG_MAX_PATH];
|
||||
char *home = tp.c_get ();
|
||||
char *buf = tp.c_get ();
|
||||
strcpy (buf, newhomedrive);
|
||||
strcat (buf, newhomepath);
|
||||
cygwin_conv_to_full_posix_path (buf, home);
|
||||
cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE, buf, home,
|
||||
NT_MAX_PATH);
|
||||
debug_printf ("Set HOME (from HOMEDRIVE/HOMEPATH) to %s", home);
|
||||
setenv ("HOME", home, 1);
|
||||
}
|
||||
@ -286,10 +287,12 @@ cygheap_user::ontherange (homebodies what, struct passwd *pw)
|
||||
|
||||
if (what != CH_HOME && homepath == NULL && newhomepath == NULL)
|
||||
{
|
||||
char *homepath_env_buf = tp.c_get ();
|
||||
if (!pw)
|
||||
pw = internal_getpwnam (name ());
|
||||
if (pw && pw->pw_dir && *pw->pw_dir)
|
||||
cygwin_conv_to_full_win32_path (pw->pw_dir, homepath_env_buf);
|
||||
cygwin_conv_path (CCP_POSIX_TO_WIN_A, pw->pw_dir, homepath_env_buf,
|
||||
NT_MAX_PATH);
|
||||
else
|
||||
{
|
||||
homepath_env_buf[0] = homepath_env_buf[1] = '\0';
|
||||
@ -301,16 +304,17 @@ cygheap_user::ontherange (homebodies what, struct passwd *pw)
|
||||
sys_mbstowcs (wuser, sizeof (wuser) / sizeof (*wuser), winname ());
|
||||
if (!(ret = NetUserGetInfo (wlogsrv, wuser, 3, (LPBYTE *) &ui)))
|
||||
{
|
||||
sys_wcstombs (homepath_env_buf, CYG_MAX_PATH,
|
||||
sys_wcstombs (homepath_env_buf, NT_MAX_PATH,
|
||||
ui->usri3_home_dir);
|
||||
if (!homepath_env_buf[0])
|
||||
{
|
||||
sys_wcstombs (homepath_env_buf, CYG_MAX_PATH,
|
||||
sys_wcstombs (homepath_env_buf, NT_MAX_PATH,
|
||||
ui->usri3_home_dir_drive);
|
||||
if (homepath_env_buf[0])
|
||||
strcat (homepath_env_buf, "\\");
|
||||
else
|
||||
cygwin_conv_to_full_win32_path ("/", homepath_env_buf);
|
||||
cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_ABSOLUTE,
|
||||
"/", homepath_env_buf, NT_MAX_PATH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user