about summary refs log tree commit diff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-28T02·26+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-02T14·46+0100
commit6055d84bebe6eecc061ef295c1fd21ceb77e7674 (patch)
tree265628fcc37fd0e96c48500b0a8381856286a4ad /src/libutil/util.cc
parent0a62d9b3d73afb8a5111cdecb23a0a4d6954493d (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/libutil/util.cc')
-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 3becbbabc2bf..25246a3e89a9 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);
 }