Skip to content

Commit f74dc93

Browse files
ChrisDentongithub-cygwin
authored andcommitted
fix native symlink spawn passing wrong arg0
Currently when starting a process from bash via a native symlink, argv[0] is set to the realpath of the executable and not to the link name. This patch fixes it so the path of the symlink is seen instead. The cause is a path conversion in perhaps_suffix which follows native symlinks. Hence the fix this patch uses is to add PC_SYM_NOFOLLOW_REP when calling path_conv::check to prevent that. Fixes: be37165 ("* path.cc (path_conv::check): Don't follow reparse point symlinks if PC_SYM_NOFOLLOW_REP flag is set.") Signed-off-by: Chris Denton <[email protected]>
1 parent 5ec497d commit f74dc93

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

winsup/cygwin/spawn.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ perhaps_suffix (const char *prog, path_conv& buf, int& err, unsigned opt)
4343

4444
err = 0;
4545
debug_printf ("prog '%s'", prog);
46-
buf.check (prog, PC_SYM_FOLLOW | PC_NULLEMPTY | PC_POSIX, stat_suffixes);
46+
buf.check (prog,
47+
PC_SYM_FOLLOW | PC_SYM_NOFOLLOW_REP | PC_NULLEMPTY | PC_POSIX,
48+
stat_suffixes);
4749

4850
if (buf.isdir ())
4951
{

0 commit comments

Comments
 (0)