summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-07-08 15:58:35 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-07-08 15:58:35 +0000
commitbae06e144a614ad8a7230d3ed1ed64843cd97c73 (patch)
tree7308598a3aaff00830d53b2e031c1e87ba6d5ac9 /ext
parente930465f0bda9d63d97d7bcbea42ed0d09f68de3 (diff)
downloadperl-bae06e144a614ad8a7230d3ed1ed64843cd97c73.tar.gz
Cwd cleanups.
p4raw-id: //depot/perl@11216
Diffstat (limited to 'ext')
-rw-r--r--ext/Cwd/Cwd.xs6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/Cwd/Cwd.xs b/ext/Cwd/Cwd.xs
index b6f27b8d09..303ef70a02 100644
--- a/ext/Cwd/Cwd.xs
+++ b/ext/Cwd/Cwd.xs
@@ -73,12 +73,14 @@ bsd_realpath(path, resolved)
return Perl_rmsexpand((char*)path, resolved, NULL, 0);
#else
struct stat sb;
- int fd, n, rootd, serrno;
+ int n, rootd, serrno;
char *p, *q, wbuf[MAXPATHLEN];
int symlinks = 0;
/* Save the starting point. */
#ifdef HAS_FCHDIR
+ int fd;
+
if ((fd = open(".", O_RDONLY)) < 0) {
(void)strcpy(resolved, ".");
return (NULL);
@@ -120,7 +122,7 @@ loop:
} else
p = resolved;
-#ifdef HAS_LSTAT
+#if defined(HAS_LSTAT) && defined(HAS_READLINK) && defined(HAS_SYMLINK)
/* Deal with the last component. */
if (lstat(p, &sb) == 0) {
if (S_ISLNK(sb.st_mode)) {