This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[perl #123802] Assertion failure with /$0{}/
[perl5.git]
/
caretx.c
diff --git
a/caretx.c
b/caretx.c
index
1059799
..
5d3318c
100644
(file)
--- a/
caretx.c
+++ b/
caretx.c
@@
-15,7
+15,7
@@
* is beyond.'
* 'Do you know the name of that high pass?' said Faramir.
*
* is beyond.'
* 'Do you know the name of that high pass?' said Faramir.
*
- * [p.
xxx
of _The Lord of the Rings_, IV/xi: "The Forbidden Pool"]
+ * [p.
691
of _The Lord of the Rings_, IV/xi: "The Forbidden Pool"]
*/
/* This file contains a single function, set_caret_X, to set the $^X
*/
/* This file contains a single function, set_caret_X, to set the $^X
@@
-52,7
+52,6
@@
void
Perl_set_caret_X(pTHX) {
void
Perl_set_caret_X(pTHX) {
- dVAR;
GV* tmpgv = gv_fetchpvs("\030", GV_ADD|GV_NOTQUAL, SVt_PV); /* $^X */
if (tmpgv) {
SV *const caret_x = GvSV(tmpgv);
GV* tmpgv = gv_fetchpvs("\030", GV_ADD|GV_NOTQUAL, SVt_PV); /* $^X */
if (tmpgv) {
SV *const caret_x = GvSV(tmpgv);
@@
-100,7
+99,13
@@
Perl_set_caret_X(pTHX) {
}
# elif defined(HAS_PROCSELFEXE)
char buf[MAXPATHLEN];
}
# elif defined(HAS_PROCSELFEXE)
char buf[MAXPATHLEN];
- int len = readlink(PROCSELFEXE_PATH, buf, sizeof(buf) - 1);
+ SSize_t len = readlink(PROCSELFEXE_PATH, buf, sizeof(buf) - 1);
+ /* NOTE: if the length returned by readlink() is sizeof(buf) - 1,
+ * it is impossible to know whether the result was truncated. */
+
+ if (len != -1) {
+ buf[len] = '\0';
+ }
/* On Playstation2 Linux V1.0 (kernel 2.2.1) readlink(/proc/self/exe)
includes a spurious NUL which will cause $^X to fail in system
/* On Playstation2 Linux V1.0 (kernel 2.2.1) readlink(/proc/self/exe)
includes a spurious NUL which will cause $^X to fail in system