summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@linbit.com>2012-09-19 01:44:11 +0200
committerAndreas Gruenbacher <agruen@linbit.com>2012-09-19 02:51:23 +0200
commitb578985c3cdf160ad58b43715bdfa324cdf15618 (patch)
tree2cfb335c7306a44a917604bdf4f5e77c1a6b36fe
parent3b934d69038a9b3729fafd43d6174dc7523a9d97 (diff)
downloadpatch-b578985c3cdf160ad58b43715bdfa324cdf15618.tar.gz
Use stat where we want to follow symlinks
* src/pch.c (prefix_components): Follow symlinks. (cwd_is_root): Follow symlinks.
-rw-r--r--src/pch.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pch.c b/src/pch.c
index 8d5f1c4..da6e68f 100644
--- a/src/pch.c
+++ b/src/pch.c
@@ -403,11 +403,11 @@ cwd_is_root (char const *name)
memcpy (root, name, prefix_len);
root[prefix_len] = '/';
root[prefix_len + 1] = 0;
- if (lstat (root, &st))
+ if (stat (root, &st))
return false;
root_dev = st.st_dev;
root_ino = st.st_ino;
- if (lstat (".", &st))
+ if (stat (".", &st))
return false;
return root_dev == st.st_dev && root_ino == st.st_ino;
}
@@ -1042,7 +1042,7 @@ prefix_components (char *filename, bool checkdirs)
if (checkdirs)
{
*f = '\0';
- stat_result = lstat (filename, &stat_buf);
+ stat_result = stat (filename, &stat_buf);
*f = '/';
if (! (stat_result == 0 && S_ISDIR (stat_buf.st_mode)))
break;