summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-06-12 00:29:20 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-12 00:29:20 +0000
commitd05c1ba08d199ec5bed1e39e74e1c4c0f8d726b6 (patch)
tree7a7b729922fd23d80bf3ffaa2ea202c204ebc501 /util.c
parent4fca3945e6d50f55c1660233803e96a8edddd182 (diff)
downloadperl-d05c1ba08d199ec5bed1e39e74e1c4c0f8d726b6.tar.gz
gcc -Wall nits picked out by a non-UNIX system
(courtesy of Mark Bixby) p4raw-id: //depot/perl@10524
Diffstat (limited to 'util.c')
-rw-r--r--util.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/util.c b/util.c
index 70a15535ef..81f413e966 100644
--- a/util.c
+++ b/util.c
@@ -4941,14 +4941,16 @@ Perl_sv_realpath(pTHX_ SV *sv, char *path, STRLEN len)
char name[MAXPATHLEN] = { 0 }, *s;
STRLEN pathlen, namelen;
+ /* Don't use strlen() to avoid running off the end. */
+ s = memchr(path, '\0', MAXPATHLEN);
+ pathlen = s ? s - path : MAXPATHLEN;
+
#ifdef HAS_REALPATH
+
/* Be paranoid about the use of realpath(),
* it is an infamous source of buffer overruns. */
- /* Is the source buffer too long?
- * Don't use strlen() to avoid running off the end. */
- s = memchr(path, '\0', MAXPATHLEN);
- pathlen = s ? s - path : MAXPATHLEN;
+ /* Is the source buffer too long? */
if (pathlen == MAXPATHLEN) {
Perl_warn(aTHX_ "sv_realpath: realpath(\"%s\"): %c= (MAXPATHLEN = %d)",
path, s ? '=' : '>', MAXPATHLEN);