Skip to content

Commit 96e0bad

Browse files
committed
Merge remote-tracking branch 'dscho/posify_shell'
2 parents 3d01fa4 + 7028eed commit 96e0bad

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

winsup/cygwin/environ.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ static win_env conv_envvars[] =
309309
{NL ("HOME="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
310310
{NL ("LD_LIBRARY_PATH="), NULL, NULL,
311311
env_plist_to_posix, env_plist_to_win32, true},
312+
{NL ("SHELL="), NULL, NULL, env_path_to_posix, env_path_to_win32, true, true},
312313
{NL ("TMPDIR="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
313314
{NL ("TMP="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
314315
{NL ("TEMP="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
@@ -337,7 +338,7 @@ static const unsigned char conv_start_chars[256] =
337338
WC, 0, 0, 0, WC, 0, 0, 0,
338339
/* 80 */
339340
/* P Q R S T U V W */
340-
WC, 0, 0, 0, WC, 0, 0, 0,
341+
WC, 0, 0, WC, WC, 0, 0, 0,
341342
/* 88 */
342343
/* x Y Z */
343344
0, 0, 0, 0, 0, 0, 0, 0,
@@ -366,6 +367,7 @@ win_env::operator = (struct win_env& x)
366367
toposix = x.toposix;
367368
towin32 = x.towin32;
368369
immediate = false;
370+
skip_if_empty = x.skip_if_empty;
369371
return *this;
370372
}
371373

@@ -387,6 +389,8 @@ win_env::add_cache (const char *in_posix, const char *in_native)
387389
native = (char *) realloc (native, namelen + 1 + strlen (in_native));
388390
stpcpy (stpcpy (native, name), in_native);
389391
}
392+
else if (skip_if_empty && !*in_posix)
393+
native = (char *) calloc(1, 1);
390394
else
391395
{
392396
tmp_pathbuf tp;
@@ -452,6 +456,8 @@ posify_maybe (char **here, const char *value, char *outenv)
452456
return;
453457

454458
int len = strcspn (src, "=") + 1;
459+
if (conv->skip_if_empty && !src[len])
460+
return;
455461

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

winsup/cygwin/environ.h

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

0 commit comments

Comments
 (0)