aboutsummaryrefslogtreecommitdiff
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-03-02 15:46:07 +0100
commit6055d84bebe6eecc061ef295c1fd21ceb77e7674 (patch)
tree265628fcc37fd0e96c48500b0a8381856286a4ad
parent0a62d9b3d73afb8a5111cdecb23a0a4d6954493d (diff)
Fix reading symlinks
The st_size field of a symlink doesn't have to be correct, e.g. for /dev/fd symlinks.
-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);
}