Skip to content

Commit 244014c

Browse files
committed
Merge remote-tracking branch 'dscho/posify_shell'
2 parents 5bb6dc7 + 73c312f commit 244014c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

winsup/cygwin/environ.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ static win_env conv_envvars[] =
326326
{NL ("HOME="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
327327
{NL ("LD_LIBRARY_PATH="), NULL, NULL,
328328
env_plist_to_posix, env_plist_to_win32, true},
329+
{NL ("SHELL="), NULL, NULL, env_path_to_posix, env_path_to_win32, true, true},
329330
{NL ("TMPDIR="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
330331
{NL ("TMP="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
331332
{NL ("TEMP="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
@@ -354,7 +355,7 @@ static const unsigned char conv_start_chars[256] =
354355
WC, 0, 0, 0, WC, 0, 0, 0,
355356
/* 80 */
356357
/* P Q R S T U V W */
357-
WC, 0, 0, 0, WC, 0, 0, 0,
358+
WC, 0, 0, WC, WC, 0, 0, 0,
358359
/* 88 */
359360
/* x Y Z */
360361
0, 0, 0, 0, 0, 0, 0, 0,
@@ -404,6 +405,8 @@ win_env::add_cache (const char *in_posix, const char *in_native)
404405
native = (char *) realloc (native, namelen + 1 + strlen (in_native));
405406
stpcpy (stpcpy (native, name), in_native);
406407
}
408+
else if (skip_if_empty && !*in_posix)
409+
native = (char *) calloc(1, 1);
407410
else
408411
{
409412
tmp_pathbuf tp;
@@ -469,6 +472,8 @@ posify_maybe (char **here, const char *value, char *outenv)
469472
return;
470473

471474
int len = strcspn (src, "=") + 1;
475+
if (conv->skip_if_empty && !src[len])
476+
return;
472477

473478
/* Turn all the items from c:<foo>;<bar> into their
474479
mounted equivalents - if there is one. */

winsup/cygwin/environ.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct win_env
2323
char *native;
2424
ssize_t (*toposix) (const void *, void *, size_t);
2525
ssize_t (*towin32) (const void *, void *, size_t);
26-
bool immediate;
26+
bool immediate, skip_if_empty;
2727
void __reg3 add_cache (const char *in_posix, const char *in_native = NULL);
2828
const char * get_native () const {return native ? native + namelen : NULL;}
2929
const char * get_posix () const {return posix ? posix : NULL;}

0 commit comments

Comments
 (0)