about summary refs log tree commit diff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2011-10-27T19·06+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2011-10-27T19·06+0000
commita12095d3be095ba9d88631e21ef6d43f1ddb5cee (patch)
tree73be6d44845928a062f62d3219a3aa5da44bb6cf /src/libexpr/eval.cc
parent00b41e46ed02d16aeea1375c14a84df02a91efba (diff)
* In printValueAsXML, handle the case where a "type" attribute is not
  a string.  This happens in the NixOS option system.
* Remove a bogus comparison of a unsigned integer with -1.

Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index d0bdaf23822a..2b97b76fb776 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -170,8 +170,8 @@ EvalState::EvalState()
             size_t size = 32 * 1024 * 1024;
 #if HAVE_SYSCONF && defined(_SC_PAGESIZE) && defined(_SC_PHYS_PAGES)
             long pageSize = sysconf(_SC_PAGESIZE);
-            long pages = sysconf (_SC_PHYS_PAGES);
-            if (pageSize != -1 && size != -1)
+            long pages = sysconf(_SC_PHYS_PAGES);
+            if (pageSize != -1)
                 size = (pageSize * pages) / 4; // 25% of RAM
             if (size > maxSize) size = maxSize;
 #endif
@@ -1108,7 +1108,10 @@ bool EvalState::isDerivation(Value & v)
 {
     if (v.type != tAttrs) return false;
     Bindings::iterator i = v.attrs->find(sType);
-    return i != v.attrs->end() && forceStringNoCtx(*i->value) == "derivation";
+    if (i == v.attrs->end()) return false;
+    forceValue(*i->value);
+    if (i->value->type != tString) return false;
+    return forceStringNoCtx(*i->value) == "derivation";
 }