diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2002-03-11 03:36:32 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-03-11 03:36:32 +0000 |
commit | d103ec31e7c314096b02a22c4f9c43a9788a0d37 (patch) | |
tree | edfe2aa4661faf4c23c61cf436695b167c161042 /perl.c | |
parent | 825e0ba0c8c2dec9c94bdee2122af88724efd944 (diff) | |
download | perl-d103ec31e7c314096b02a22c4f9c43a9788a0d37.tar.gz |
Re: [PATCH] for broken /proc/curproc/file on FreeBSD
From: Nicholas Clark <nick@unfortu.net>
Date: Sun, 10 Mar 2002 18:17:50 +0000
Message-ID: <20020310181749.GC317@Bagpuss.unfortu.net>
Subject: Re: [PATCH] for broken /proc/curproc/file on FreeBSD
From: sthoenna@efn.org (Yitzchak Scott-Thoennes)
Date: Sun, 10 Mar 2002 13:53:34 -0800
Message-ID: <eX9i8gzkg26G092yn@efn.org>
(and reenable the feature in freebsd,
and move the freebsd pr url to perl.c)
p4raw-id: //depot/perl@15160
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -3441,7 +3441,13 @@ S_procself_val(pTHX_ SV *sv, char *arg0) { char buf[MAXPATHLEN]; int len = readlink(PROCSELFEXE_PATH, buf, sizeof(buf) - 1); - if (len > 0) { + /* FreeBSD's implementation is acknowledged to be imperfect, sometimes + returning the text "unknown" from the readlink rather than the path + to the exacutable (or returing an error from the readlink). Any valid + path has a '/' in it somewhere, so use that to validate the result. + See http://www.freebsd.org/cgi/query-pr.cgi?pr=35703 + */ + if (len > 0 && memchr (buf, '/', len)) { sv_setpvn(sv,buf,len); } else { |