summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorTim Jenness <tjenness@cpan.org>2002-06-11 01:55:40 -1000
committerJarkko Hietaniemi <jhi@iki.fi>2002-06-12 01:35:57 +0000
commit75745e22e13d8864c5073aba44ed9805a466b45e (patch)
treec75dc99010b9a14e5b03e7aa4f38674356bae29f /perl.c
parentfc0bf671453fcec7b45b1911adfd5f2cb3c807b5 (diff)
downloadperl-75745e22e13d8864c5073aba44ed9805a466b45e.tar.gz
Re: RC1 on Playstation2
Message-ID: <Pine.LNX.4.44.0206111135130.31715-100000@lapaki> p4raw-id: //depot/perl@17194
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/perl.c b/perl.c
index 8566e5f7e6..e4ca5a005e 100644
--- a/perl.c
+++ b/perl.c
@@ -3528,6 +3528,17 @@ S_procself_val(pTHX_ SV *sv, char *arg0)
{
char buf[MAXPATHLEN];
int len = readlink(PROCSELFEXE_PATH, buf, sizeof(buf) - 1);
+
+ /* 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
+ or backticks (this will prevent extensions from being built and
+ many tests from working). readlink is not meant to add a NUL.
+ Normal readlink works fine.
+ */
+ if (len > 0 && buf[len-1] == '\0') {
+ len--;
+ }
+
/* FreeBSD's implementation is acknowledged to be imperfect, sometimes
returning the text "unknown" from the readlink rather than the path
to the executable (or returning an error from the readlink). Any valid