From: Gurusamy Sarathy Date: Sun, 5 Mar 2000 17:13:48 +0000 (+0000) Subject: strip last component of SITELIB_EXP only if it looks like a X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7785d218894ec033856d95749a4e3d546eb61f33;p=p5sagit%2Fp5-mst-13.2.git strip last component of SITELIB_EXP only if it looks like a number p4raw-id: //depot/perl@5545 --- diff --git a/perl.c b/perl.c index 37f68e7..4b3b3e8 100644 --- a/perl.c +++ b/perl.c @@ -3257,10 +3257,15 @@ S_init_perllib(pTHX) if (path) { char buf[1024]; - strcpy(buf,path); - if (strrchr(buf,'/')) /* XXX Hack, Configure var needed */ - *strrchr(buf,'/') = '\0'; - incpush(buf, TRUE); + char *ver = strrchr(path,'/'); /* XXX Hack, Configure var needed */ + if (ver && ver[1] == (STRINGIFY(PERL_REVISION))[0] + && strlen(path) < sizeof(buf)) + { + strcpy(buf,path); + buf[ver-path] = '\0'; + path = buf; + } + incpush(path, TRUE); } } #endif