aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/parser.y')
-rw-r--r--src/libexpr/parser.y9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index 8ac3345c1..3540058bc 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -369,9 +369,12 @@ Expr parseExprFromFile(EvalState & state, Path path)
/* If `path' is a symlink, follow it. This is so that relative
path references work. */
struct stat st;
- if (lstat(path.c_str(), &st))
- throw SysError(format("getting status of `%1%'") % path);
- if (S_ISLNK(st.st_mode)) path = absPath(readLink(path), dirOf(path));
+ while (true) {
+ if (lstat(path.c_str(), &st))
+ throw SysError(format("getting status of `%1%'") % path);
+ if (!S_ISLNK(st.st_mode)) break;
+ path = absPath(readLink(path), dirOf(path));
+ }
/* If `path' refers to a directory, append `/default.nix'. */
if (stat(path.c_str(), &st))