-
Notifications
You must be signed in to change notification settings - Fork 584
WIP Add resolving of $PROGRAM_NAME from /dev/fd/number #23358
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
base: blead
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -988,6 +988,7 @@ Michael Somos <[email protected]> | |
Michael Stevens <[email protected]> | ||
Michael van Elst <[email protected]> | ||
Michael Witten <[email protected]> | ||
Michal Josef Špaček <[email protected]> | ||
Michele Sardo | ||
Michiel Beijen <[email protected]> | ||
Mik Firestone <[email protected]> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4227,6 +4227,19 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, bool *suidscript) | |
Safefree(PL_origfilename); | ||
PL_origfilename = (char *)scriptname; | ||
} | ||
else { | ||
char proc_fd_path[64]; | ||
snprintf(proc_fd_path, sizeof(proc_fd_path), "/proc/self/fd/%d", fdscript); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The c stack buffer should really be The CC will round up C auto var |
||
char target_path[MAXPATHLEN]; | ||
SSize_t len = readlink(proc_fd_path, target_path, sizeof(target_path) - 1); | ||
if (len != -1) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On Linux and FooNix OSes, MAXPATHLEN is constant Those 3 buffer lengths are an alligator [ Since this huge C stk buffer is not used on all control flow paths through I have no tech/coding problem with this huge size + very short life span C stack buffer. I don't want to see it become another bloated wasteful On WinPerl because of a P5P bug, CPP macro |
||
Stat_t statbuf; | ||
target_path[len] = '\0'; | ||
if (PerlLIO_stat(target_path, &statbuf) == 0 && S_ISREG(statbuf.st_mode)) { | ||
scriptname = PL_origfilename = find_script(target_path, dosearch, NULL, 1); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this
else {
block starting here really should be split off into a separate static, not-inline function, see my other comment below why this is needed