Skip to content

Bug-877: Memory fault when attempting to run /dev/fd/1 as a script #879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/cmd/ksh93/sh/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1341,9 +1341,11 @@ Shell_t *sh_init(int argc,char *argv[], Shinit_f userinit)
else
sh_offoption(SH_PRIVILEGED);
/* shname for $0 in profiles and . scripts */
#if 0 /* bug-877: Phi: No need for this /dev/fd0 is like /dev/stdin */
if(sh_isdevfd(argv[1]))
sh.shname = sh_strdup(argv[0]);
else
#endif
sh.shname = sh_strdup(sh.st.dolv[0]);
/*
* return here for shell script execution
Expand Down
3 changes: 2 additions & 1 deletion src/cmd/ksh93/sh/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ noreturn void sh_main(int ac, char *av[], Shinit_f userinit)
{
char *sp;
/* open stream should have been passed into shell */
if(strmatch(name,e_devfdNN))
/* bug-877: Phi: No need for this */
if( 0 && strmatch(name,e_devfdNN))
{
fdin = (int)strtol(name+8, NULL, 10);
if(fstat(fdin,&statb)<0)
Expand Down