diff options
Diffstat (limited to 'src/libstore/derivations.cc')
-rw-r--r-- | src/libstore/derivations.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc index 7ea4d50e6..6678227fe 100644 --- a/src/libstore/derivations.cc +++ b/src/libstore/derivations.cc @@ -152,11 +152,10 @@ StorePath writeDerivation(Store & store, /* Read string `s' from stream `str'. */ static void expect(std::istream & str, std::string_view s) { - char s2[s.size()]; - str.read(s2, s.size()); - std::string_view s2View { s2, s.size() }; - if (s2View != s) - throw FormatError("expected string '%s', got '%s'", s, s2View); + for (auto & c : s) { + if (str.get() != c) + throw FormatError("expected string '%1%'", s); + } } |