From: Robin Barker Date: Sat, 22 Dec 2007 00:52:54 +0000 (+0000) Subject: The ext/Cwd/Cwd.xs part of... X-Git-Tag: GitLive-blead~1585 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/f57255841c18e91c7a719a2400645e39398f3947 The ext/Cwd/Cwd.xs part of... Subject: consting Cwd and ExtUtils::ParseXS From: "Robin Barker" Message-ID: <46A0F33545E63740BC7563DE59CA9C6D0939A0@exchsvr2.npl.ad.local> lib/ExtUtils/ParseXS.pm had changes already made with change #32691. p4raw-id: //depot/perl@32710 --- diff --git a/ext/Cwd/Cwd.xs b/ext/Cwd/Cwd.xs index 7434dfa..4958bd2 100644 --- a/ext/Cwd/Cwd.xs +++ b/ext/Cwd/Cwd.xs @@ -79,7 +79,8 @@ bsd_realpath(const char *path, char *resolved) return Perl_rmsexpand(aTHX_ (char*)path, resolved, NULL, 0); #else int rootd, serrno; - char *p, *q, wbuf[MAXPATHLEN]; + const char *p; + char *q, wbuf[MAXPATHLEN]; int symlinks = 0; /* Save the starting point. */ @@ -112,17 +113,18 @@ bsd_realpath(const char *path, char *resolved) loop: q = strrchr(resolved, '/'); if (q != NULL) { + const char *dir; p = q + 1; if (q == resolved) - q = "/"; + dir = "/"; else { do { --q; } while (q > resolved && *q == '/'); q[1] = '\0'; - q = resolved; + dir = resolved; } - if (chdir(q) < 0) + if (chdir(dir) < 0) goto err1; } else p = resolved;