From 6055d84bebe6eecc061ef295c1fd21ceb77e7674 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 28 Feb 2016 03:26:46 +0100 Subject: [PATCH] Fix reading symlinks The st_size field of a symlink doesn't have to be correct, e.g. for /dev/fd symlinks. --- src/libutil/util.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); }