Skip to content

Commit 8095a41

Browse files
committed
Make paths' WCS->MBS conversion explicit
* dcrt0.cc (dll_crt0_1), dtable.cc (handle_to_fn), environ.cc (environ_init, getwinenveq, build_env), external.cc (fillout_pinfo), fhandler_disk_file.cc (__DIR_mounts::eval_ino, fhandler_disk_file::readdir_helper), fhandler_netdrive.cc (fhandler_netdrive::readdir), fhandler_process.cc (format_process_winexename, format_process_maps, format_process_stat, format_process_status), fhandler_procsys.cc (fill_filebuf, fhandler_procsys::readdir), mount.cc (fs_info::update, mount_info::create_root_entry, mount_info::conv_to_posix_path, mount_info::from_fstab_line), nlsfuncs.cc (internal_setlocale), path.cc (path_conv::check, sysmlink_info::check_shortcut, symlink_info::check_sysfile, symlink_info::check_reparse_point, symlink_info::check_nfs_symlink, cygwin_conv_path, cygwin_conv_path_list, cwdstuff::get_error_desc, cwdstuff::get), strfuncs.cc (sys_wcstombs_no_path, sys_wcstombs_alloc_no_path), uinfo.cc (ontherange, fetch_from_path, cygheap_pwdgrp::get_home, cygheap_pwdgrp::get_shell, cygheap_pwdgrp::get_gecos), wchar.h (sys_wcstombs_no_path, sys_wcstombs_alloc_no_path): Convert call sites of the sys_wcstombs*() family to specify explicitly when the parameter refers to a path or file name, to avoid future misconversions. Detailed explanation: The sys_wcstombs() function contains special handling for paths/file names, to work around file name restriction on Windows that are unexpected in the POSIX context of Cygwin. We actually do not want that special handling for WCS strings that do *not* refer to paths or file names. Neither do we want to convert those special file names unless they come from inside Cygwin: if the source of the string value is the Windows API, we *know* it cannot be such a special file name because Windows itself would not be able to handle it in the way Cygwin does. So let's switch the previous sys_wcstombs()/sys_wcstombs_no_path() (and the *_alloc* variant) around to sys_wcstombs_path()/sys_wcstombs(). We do this for several reasons: - whenever a call site wants to convert a WCS representation of a path or file name to an MBS one, it should be made very clear that we *want* the special file name conversion to happen. - it is shorter to read and write. - future calls to sys_wcstombs() will not incur unwanted conversion by accident (it is easy for unsuspecting programmers to assume that the function name "sys_wcstombs()" refers to a regular text conversion that has nothing to do with paths or filenames). By keeping the name sys_wcstombs() (and not switching to sys_wcstombs_path()), the following call sites are implicitly changed to *exclude* the special path/file name conversion: cygheap.h (get_drive): Cannot contain special characters dcrt0.cc (dll_crt0_1): Is input from outside of Cygwin environ.cc (getwinenveq): Is input from outside of Cygwin external.cc (cygwin_internal): Refers to user/domain names, not paths fhandler_clipboard.cc (fhandler_dev_clipboard::read): Is not a path or file name but characters from the Windows clipboard fhandler_console.cc: (dev_console::con_to_str): Is not a path or file name but characters from the console fhandler_registry.cc (encode_regname): Is a registry key, not a path or filename fhandler_registry.cc (multi_wcstombs): All call sites pass registry values, not paths or filenames fhandler_registry.cc (fstat): Is a registry value, not a path or filename fhandler_registry.cc (fill_filebuf): Is a registry value, not a path or filename miscfuncs.cc (strlwr): TODO miscfuncs.cc (strupr): TODO net.cc (get_ipv4fromreg): Is a registry value, not a path or filename net.cc (get_friendlyname): Is a device name, not a path or filename netdb.cc (open_system_file): Is from outside Cygwin smallprint.cc (__small_vsprintf): Is a free text, not a path or filename uinfo.cc (cygheap_user::init): Refers to a user name, not a path or filename uinfo.cc (pwdgrp::fetch_account_from_windows): Refers to value from outside Cygwin By keeping the function name sys_wcstombs_alloc() (and not changing it to sys_wcstombs_alloc_path()), the following call sites are implicitly changed to *exclude* the special path/file name conversion: environ.cc (environ_init): Is input from outside of Cygwin environ.cc (build_env): Refers to the environment from outside Cygwin ldap.cc (cyg_ldap::remap_uid): Refers to a user name, not a path or filename ldap.cc (cyg_ldap::remap_gid): Refers to a group name, not a path or filename pinfo.cc (_pinfo::cmdline): Refers to a command line from Windows, outside Cygwin uinfo.cc (cygheap_user::env_logsrv): Is a server name, not a path or filename uinfo.cc (cygheap_user::env_domain): Refers to the user/domain name, not a path or filename uinfo.cc (cygheap_user::env_userprofile): Refers to Windows' idea of a path, outside Cygwin uinfo.cc (cygheap_user::env_systemroot): Refers to Windows' idea of a path, outside Cygwin uinfo.cc (fetch_from_description): Refers to values from outside of Cygwin uinfo.cc (cygheap_pwdgrp::get_gecos): Refers to user/domain name and email address, not path nor filename Signed-off-by: Johannes Schindelin <[email protected]>
1 parent d50e35a commit 8095a41

14 files changed

+62
-56
lines changed

winsup/cygwin/dcrt0.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -935,9 +935,9 @@ dll_crt0_1 (void *)
935935
if (!__argc)
936936
{
937937
PWCHAR wline = GetCommandLineW ();
938-
size_t size = sys_wcstombs_no_path (NULL, 0, wline) + 1;
938+
size_t size = sys_wcstombs (NULL, 0, wline) + 1;
939939
char *line = (char *) alloca (size);
940-
sys_wcstombs_no_path (line, size, wline);
940+
sys_wcstombs (line, size, wline);
941941

942942
/* Scan the command line and build argv. Expand wildcards if not
943943
called from another cygwin process. */

winsup/cygwin/dtable.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ handle_to_fn (HANDLE h, char *posix_fn)
995995
if (wcsncasecmp (w32, DEVICE_PREFIX, DEVICE_PREFIX_LEN) != 0
996996
|| !QueryDosDeviceW (NULL, fnbuf, sizeof (fnbuf) / sizeof (WCHAR)))
997997
{
998-
sys_wcstombs (posix_fn, NT_MAX_PATH, w32, w32len);
998+
sys_wcstombs_path (posix_fn, NT_MAX_PATH, w32, w32len);
999999
return false;
10001000
}
10011001

winsup/cygwin/environ.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ win32env_to_cygenv (PWCHAR rawenv, bool posify)
863863
eventually want to use them). */
864864
for (i = 0, w = rawenv; *w != L'\0'; w = wcschr (w, L'\0') + 1, i++)
865865
{
866-
sys_wcstombs_alloc_no_path (&newp, HEAP_NOTHEAP, w);
866+
sys_wcstombs_alloc (&newp, HEAP_NOTHEAP, w);
867867
if (i >= envc)
868868
envp = (char **) realloc (envp, (4 + (envc += 100)) * sizeof (char *));
869869
envp[i] = newp;
@@ -921,15 +921,15 @@ getwinenveq (const char *name, size_t namelen, int x)
921921
int totlen = GetEnvironmentVariableW (name0, valbuf, 32768);
922922
if (totlen > 0)
923923
{
924-
totlen = sys_wcstombs_no_path (NULL, 0, valbuf) + 1;
924+
totlen = sys_wcstombs (NULL, 0, valbuf) + 1;
925925
if (x == HEAP_1_STR)
926926
totlen += namelen;
927927
else
928928
namelen = 0;
929929
char *p = (char *) cmalloc_abort ((cygheap_types) x, totlen);
930930
if (namelen)
931931
strcpy (p, name);
932-
sys_wcstombs_no_path (p + namelen, totlen, valbuf);
932+
sys_wcstombs (p + namelen, totlen, valbuf);
933933
debug_printf ("using value from GetEnvironmentVariable for '%W'", name0);
934934
return p;
935935
}
@@ -1082,7 +1082,7 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
10821082
for (winnum = 0, var = cwinenv;
10831083
*var;
10841084
++winnum, var = wcschr (var, L'\0') + 1)
1085-
sys_wcstombs_alloc_no_path (&winenv[winnum], HEAP_NOTHEAP, var);
1085+
sys_wcstombs_alloc (&winenv[winnum], HEAP_NOTHEAP, var);
10861086
}
10871087
DestroyEnvironmentBlock (cwinenv);
10881088
/* Eliminate variables which are already available in envp, as well as

winsup/cygwin/external.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ fillout_pinfo (pid_t pid, int winpid)
8888
ep.rusage_self = p->rusage_self;
8989
ep.rusage_children = p->rusage_children;
9090
ep.progname[0] = '\0';
91-
sys_wcstombs(ep.progname, MAX_PATH, p->progname);
91+
sys_wcstombs_path (ep.progname, MAX_PATH, p->progname);
9292
ep.strace_mask = 0;
9393
ep.version = EXTERNAL_PINFO_VERSION;
9494

winsup/cygwin/fhandler_disk_file.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class __DIR_mounts
5050
char *c = stpcpy (fname, parent_dir);
5151
if (c[- 1] != '/')
5252
*c++ = '/';
53-
sys_wcstombs (c, mounts[idx].Length + 1,
53+
sys_wcstombs_path (c, mounts[idx].Length + 1,
5454
mounts[idx].Buffer, mounts[idx].Length / sizeof (WCHAR));
5555
path_conv pc (fname, PC_SYM_NOFOLLOW | PC_POSIX | PC_KEEP_HANDLE);
5656
if (!stat_worker (pc, &st))
@@ -2057,7 +2057,7 @@ fhandler_disk_file::readdir_helper (DIR *dir, dirent *de, DWORD w32_err,
20572057
char *p = stpcpy (file, pc.get_posix ());
20582058
if (p[-1] != '/')
20592059
*p++ = '/';
2060-
sys_wcstombs (p, NT_MAX_PATH - (p - file),
2060+
sys_wcstombs_path (p, NT_MAX_PATH - (p - file),
20612061
fname->Buffer, fname->Length / sizeof (WCHAR));
20622062
path_conv fpath (file, PC_SYM_NOFOLLOW);
20632063
if (fpath.issymlink ())
@@ -2078,7 +2078,7 @@ fhandler_disk_file::readdir_helper (DIR *dir, dirent *de, DWORD w32_err,
20782078
}
20792079
}
20802080

2081-
sys_wcstombs (de->d_name, NAME_MAX + 1, fname->Buffer,
2081+
sys_wcstombs_path (de->d_name, NAME_MAX + 1, fname->Buffer,
20822082
fname->Length / sizeof (WCHAR));
20832083

20842084
/* Don't try to optimize relative to dir->__d_position. On several

winsup/cygwin/fhandler_netdrive.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,15 @@ fhandler_netdrive::readdir (DIR *dir, dirent *de)
252252
tp.u_get (&ds);
253253
RtlInitUnicodeString (&ss, bs);
254254
RtlDowncaseUnicodeString (&ds, &ss, FALSE);
255-
sys_wcstombs (de->d_name, sizeof de->d_name,
255+
sys_wcstombs_path (de->d_name, sizeof de->d_name,
256256
ds.Buffer, ds.Length / sizeof (WCHAR));
257257
de->d_ino = hash_path_name (get_ino (), de->d_name);
258258
}
259259
else
260260
{
261-
sys_wcstombs (de->d_name, sizeof de->d_name, bs);
261+
sys_wcstombs_path (de->d_name, sizeof de->d_name, bs);
262262
char *rpath = tp.c_get ();
263-
sys_wcstombs (rpath, NT_MAX_PATH, nro->lpRemoteName);
263+
sys_wcstombs_path (rpath, NT_MAX_PATH, nro->lpRemoteName);
264264
de->d_ino = readdir_get_ino (rpath, false);
265265
/* We can't trust remote inode numbers of only 32 bit. That means,
266266
remote NT4 NTFS, as well as shares of Samba version < 3.0. */

winsup/cygwin/fhandler_process.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -565,10 +565,10 @@ static off_t
565565
format_process_winexename (void *data, char *&destbuf)
566566
{
567567
_pinfo *p = (_pinfo *) data;
568-
size_t len = sys_wcstombs (NULL, 0, p->progname);
568+
size_t len = sys_wcstombs_path (NULL, 0, p->progname);
569569
destbuf = (char *) crealloc_abort (destbuf, len + 1);
570570
/* With trailing \0 for backward compat reasons. */
571-
sys_wcstombs (destbuf, len + 1, p->progname);
571+
sys_wcstombs_path (destbuf, len + 1, p->progname);
572572
return len;
573573
}
574574

@@ -1028,7 +1028,7 @@ format_process_maps (void *data, char *&destbuf)
10281028
drive_maps.fixup_if_match (msi->SectionFileName.Buffer);
10291029
if (mount_table->conv_to_posix_path (dosname,
10301030
posix_modname, 0))
1031-
sys_wcstombs (posix_modname, NT_MAX_PATH, dosname);
1031+
sys_wcstombs_path (posix_modname, NT_MAX_PATH, dosname);
10321032
stat64 (posix_modname, &st);
10331033
}
10341034
else if (!threads.fill_if_match (cur.abase, mb.Type,
@@ -1074,7 +1074,7 @@ format_process_stat (void *data, char *&destbuf)
10741074
else
10751075
{
10761076
PWCHAR last_slash = wcsrchr (p->progname, L'\\');
1077-
sys_wcstombs (cmd, NAME_MAX + 1,
1077+
sys_wcstombs_path (cmd, NAME_MAX + 1,
10781078
last_slash ? last_slash + 1 : p->progname);
10791079
int len = strlen (cmd);
10801080
if (len > 4)
@@ -1192,7 +1192,8 @@ format_process_status (void *data, char *&destbuf)
11921192
vmtext = 0UL, vmshare = 0UL;
11931193

11941194
PWCHAR last_slash = wcsrchr (p->progname, L'\\');
1195-
sys_wcstombs (cmd, NAME_MAX + 1, last_slash ? last_slash + 1 : p->progname);
1195+
sys_wcstombs_path (cmd, NAME_MAX + 1,
1196+
last_slash ? last_slash + 1 : p->progname);
11961197
int len = strlen (cmd);
11971198
if (len > 4)
11981199
{

winsup/cygwin/fhandler_procsys.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,11 @@ fhandler_procsys::fill_filebuf ()
241241
NtClose (h);
242242
if (!NT_SUCCESS (status))
243243
goto unreadable;
244-
len = sys_wcstombs (NULL, 0, target.Buffer, target.Length / sizeof (WCHAR));
244+
len = sys_wcstombs_path (NULL, 0,
245+
target.Buffer, target.Length / sizeof (WCHAR));
245246
filebuf = (char *) crealloc_abort (filebuf, procsys_len + len + 1);
246-
sys_wcstombs (fnamep = stpcpy (filebuf, procsys), len + 1, target.Buffer,
247-
target.Length / sizeof (WCHAR));
247+
sys_wcstombs_path (fnamep = stpcpy (filebuf, procsys), len + 1,
248+
target.Buffer, target.Length / sizeof (WCHAR));
248249
while ((fnamep = strchr (fnamep, '\\')))
249250
*fnamep = '/';
250251
return true;
@@ -353,7 +354,7 @@ fhandler_procsys::readdir (DIR *dir, dirent *de)
353354
res = ENMFILE;
354355
else
355356
{
356-
sys_wcstombs (de->d_name, NAME_MAX + 1, f.dbi.ObjectName.Buffer,
357+
sys_wcstombs_path (de->d_name, NAME_MAX + 1, f.dbi.ObjectName.Buffer,
357358
f.dbi.ObjectName.Length / sizeof (WCHAR));
358359
de->d_ino = hash_path_name (get_ino (), de->d_name);
359360
if (RtlEqualUnicodeString (&f.dbi.ObjectTypeName, &ro_u_natdir,

winsup/cygwin/mount.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
436436
{
437437
/* The filesystem name is only used in fillout_mntent and only if
438438
the filesystem isn't one of the well-known filesystems anyway. */
439-
sys_wcstombs (fsn, sizeof fsn, ffai_buf.ffai.FileSystemName,
439+
sys_wcstombs_path (fsn, sizeof fsn, ffai_buf.ffai.FileSystemName,
440440
ffai_buf.ffai.FileSystemNameLength / sizeof (WCHAR));
441441
strlwr (fsn);
442442
}
@@ -463,7 +463,7 @@ mount_info::create_root_entry (const PWCHAR root)
463463
/* Create a default root dir derived from the location of the Cygwin DLL.
464464
The entry is immutable, unless the "override" option is given in /etc/fstab. */
465465
char native_root[PATH_MAX];
466-
sys_wcstombs (native_root, PATH_MAX, root);
466+
sys_wcstombs_path (native_root, PATH_MAX, root);
467467
assert (*native_root != '\0');
468468
if (add_item (native_root, "/",
469469
MOUNT_SYSTEM | MOUNT_BINARY | MOUNT_IMMUTABLE | MOUNT_AUTOMATIC | MOUNT_NOACL)
@@ -859,7 +859,7 @@ mount_info::conv_to_posix_path (PWCHAR src_path, char *posix_path,
859859
}
860860
tmp_pathbuf tp;
861861
char *buf = tp.c_get ();
862-
sys_wcstombs (buf, NT_MAX_PATH, src_path);
862+
sys_wcstombs_path (buf, NT_MAX_PATH, src_path);
863863
int ret = conv_to_posix_path (buf, posix_path, ccp_flags);
864864
if (changed)
865865
src_path[0] = L'C';
@@ -1205,7 +1205,7 @@ mount_info::from_fstab_line (char *line, bool user)
12051205
{
12061206
tmp_pathbuf tp;
12071207
char *mb_tmp = tp.c_get ();
1208-
sys_wcstombs (mb_tmp, PATH_MAX, tmp);
1208+
sys_wcstombs_path (mb_tmp, PATH_MAX, tmp);
12091209

12101210
mount_flags |= MOUNT_USER_TEMP;
12111211
int res = mount_table->add_item (mb_tmp, posix_path, mount_flags);

winsup/cygwin/nlsfuncs.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ internal_setlocale ()
15501550
if (w_path)
15511551
{
15521552
char *c_path = tp.c_get ();
1553-
sys_wcstombs (c_path, 32768, w_path);
1553+
sys_wcstombs_path (c_path, 32768, w_path);
15541554
setenv ("PATH", c_path, 1);
15551555
}
15561556
}

winsup/cygwin/path.cc

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,8 @@ path_conv::check (const UNICODE_STRING *src, unsigned opt,
642642
char *path = tp.c_get ();
643643

644644
user_shared->warned_msdos = true;
645-
sys_wcstombs (path, NT_MAX_PATH, src->Buffer, src->Length / sizeof (WCHAR));
645+
sys_wcstombs_path (path, NT_MAX_PATH,
646+
src->Buffer, src->Length / sizeof (WCHAR));
646647
path_conv::check (path, opt, suffixes);
647648
}
648649

@@ -2314,7 +2315,7 @@ symlink_info::check_shortcut (HANDLE h)
23142315
if (*(PWCHAR) cp == 0xfeff) /* BOM */
23152316
{
23162317
char *tmpbuf = tp.c_get ();
2317-
if (sys_wcstombs (tmpbuf, NT_MAX_PATH, (PWCHAR) (cp + 2))
2318+
if (sys_wcstombs_path (tmpbuf, NT_MAX_PATH, (PWCHAR) (cp + 2))
23182319
> SYMLINK_MAX)
23192320
return 0;
23202321
res = posixify (tmpbuf);
@@ -2395,7 +2396,7 @@ symlink_info::check_sysfile (HANDLE h)
23952396
else
23962397
srcbuf += 2;
23972398
char *tmpbuf = tp.c_get ();
2398-
if (sys_wcstombs (tmpbuf, NT_MAX_PATH, (PWCHAR) srcbuf)
2399+
if (sys_wcstombs_path (tmpbuf, NT_MAX_PATH, (PWCHAR) srcbuf)
23992400
> SYMLINK_MAX)
24002401
debug_printf ("symlink string too long");
24012402
else
@@ -2482,7 +2483,7 @@ symlink_info::check_reparse_point (HANDLE h, bool remote)
24822483
fileattr &= ~FILE_ATTRIBUTE_REPARSE_POINT;
24832484
return 0;
24842485
}
2485-
sys_wcstombs (srcbuf, SYMLINK_MAX + 7, subst.Buffer,
2486+
sys_wcstombs_path (srcbuf, SYMLINK_MAX + 7, subst.Buffer,
24862487
subst.Length / sizeof (WCHAR));
24872488
pflags |= PATH_SYMLINK | PATH_REP;
24882489
/* A symlink is never a directory. */
@@ -2515,7 +2516,7 @@ symlink_info::check_nfs_symlink (HANDLE h)
25152516
{
25162517
PWCHAR spath = (PWCHAR)
25172518
(pffei->EaName + pffei->EaNameLength + 1);
2518-
res = sys_wcstombs (contents, SYMLINK_MAX + 1,
2519+
res = sys_wcstombs_path (contents, SYMLINK_MAX + 1,
25192520
spath, pffei->EaValueLength);
25202521
pflags |= PATH_SYMLINK;
25212522
}
@@ -3547,7 +3548,7 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
35473548
}
35483549
PUNICODE_STRING up = p.get_nt_native_path ();
35493550
buf = tp.c_get ();
3550-
sys_wcstombs (buf, NT_MAX_PATH,
3551+
sys_wcstombs_path (buf, NT_MAX_PATH,
35513552
up->Buffer, up->Length / sizeof (WCHAR));
35523553
/* Convert native path to standard DOS path. */
35533554
if (!strncmp (buf, "\\??\\", 4))
@@ -3560,11 +3561,11 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
35603561
{
35613562
/* Device name points to somewhere else in the NT namespace.
35623563
Use GLOBALROOT prefix to convert to Win32 path. */
3563-
char *p = buf + sys_wcstombs (buf, NT_MAX_PATH,
3564+
char *p = buf + sys_wcstombs_path (buf, NT_MAX_PATH,
35643565
ro_u_globalroot.Buffer,
35653566
ro_u_globalroot.Length
35663567
/ sizeof (WCHAR));
3567-
sys_wcstombs (p, NT_MAX_PATH - (p - buf),
3568+
sys_wcstombs_path (p, NT_MAX_PATH - (p - buf),
35683569
up->Buffer, up->Length / sizeof (WCHAR));
35693570
}
35703571
lsiz = strlen (buf) + 1;
@@ -3938,8 +3939,8 @@ cygwin_conv_path_list (cygwin_conv_path_t what, const void *from, void *to,
39383939
switch (what & CCP_CONVTYPE_MASK)
39393940
{
39403941
case CCP_WIN_W_TO_POSIX:
3941-
if (!sys_wcstombs_alloc (&winp, HEAP_NOTHEAP, (const wchar_t *) from,
3942-
(size_t) -1))
3942+
if (!sys_wcstombs_alloc_path (&winp, HEAP_NOTHEAP,
3943+
(const wchar_t *) from, (size_t) -1))
39433944
return -1;
39443945
what = (what & ~CCP_CONVTYPE_MASK) | CCP_WIN_A_TO_POSIX;
39453946
from = (const void *) winp;
@@ -4881,9 +4882,9 @@ cwdstuff::get_error_desc () const
48814882
void
48824883
cwdstuff::reset_posix (wchar_t *w_cwd)
48834884
{
4884-
size_t len = sys_wcstombs (NULL, (size_t) -1, w_cwd);
4885+
size_t len = sys_wcstombs_path (NULL, (size_t) -1, w_cwd);
48854886
posix = (char *) crealloc_abort (posix, len + 1);
4886-
sys_wcstombs (posix, len + 1, w_cwd);
4887+
sys_wcstombs_path (posix, len + 1, w_cwd);
48874888
}
48884889

48894890
char *
@@ -4906,7 +4907,7 @@ cwdstuff::get (char *buf, int need_posix, int with_chroot, unsigned ulen)
49064907
if (!need_posix)
49074908
{
49084909
tocopy = tp.c_get ();
4909-
sys_wcstombs (tocopy, NT_MAX_PATH, win32.Buffer,
4910+
sys_wcstombs_path (tocopy, NT_MAX_PATH, win32.Buffer,
49104911
win32.Length / sizeof (WCHAR));
49114912
}
49124913
else

winsup/cygwin/strfuncs.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,13 +490,13 @@ sys_wcstombs (char *dst, size_t len, const wchar_t *src, size_t nwc,
490490
}
491491

492492
size_t __reg3
493-
sys_wcstombs (char *dst, size_t len, const wchar_t * src, size_t nwc)
493+
sys_wcstombs_path (char *dst, size_t len, const wchar_t * src, size_t nwc)
494494
{
495495
return sys_wcstombs (dst, len, src, nwc, true);
496496
}
497497

498498
size_t __reg3
499-
sys_wcstombs_no_path (char *dst, size_t len, const wchar_t * src, size_t nwc)
499+
sys_wcstombs (char *dst, size_t len, const wchar_t * src, size_t nwc)
500500
{
501501
return sys_wcstombs (dst, len, src, nwc, false);
502502
}
@@ -534,13 +534,13 @@ sys_wcstombs_alloc (char **dst_p, int type, const wchar_t *src, size_t nwc,
534534
}
535535

536536
size_t __reg3
537-
sys_wcstombs_alloc (char **dst_p, int type, const wchar_t *src, size_t nwc)
537+
sys_wcstombs_alloc_path (char **dst_p, int type, const wchar_t *src, size_t nwc)
538538
{
539539
return sys_wcstombs_alloc (dst_p, type, src, nwc, true);
540540
}
541541

542542
size_t __reg3
543-
sys_wcstombs_alloc_no_path (char **dst_p, int type, const wchar_t *src,
543+
sys_wcstombs_alloc (char **dst_p, int type, const wchar_t *src,
544544
size_t nwc)
545545
{
546546
return sys_wcstombs_alloc (dst_p, type, src, nwc, false);

0 commit comments

Comments
 (0)