aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-28 03:26:46 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-28 03:27:34 +0100
commit012f8d187c1a4260ecd931ef69c7d4c83029d088 (patch)
tree58b9d48eb8dfac9010a3286a62be7c5f50fe17e9 /src
parentd0344dd2c1ca5ea0a300bd9f407a8810e92f31a0 (diff)
Fix reading symlinks
The st_size field of a symlink doesn't have to be correct, e.g. for /dev/fd symlinks.
Diffstat (limited to 'src')
-rw-r--r--src/libutil/util.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 3becbbabc..25246a3e8 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -209,7 +209,7 @@ Path readLink(const Path & path)
else if (rlsize > st.st_size)
throw Error(format("symbolic link ‘%1%’ size overflow %2% > %3%")
% path % rlsize % st.st_size);
- return string(buf, st.st_size);
+ return string(buf, rlsize);
}