aboutsummaryrefslogtreecommitdiff
path: root/src/nix-store
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-08-16 16:15:05 +0200
committerGitHub <noreply@github.com>2019-08-16 16:15:05 +0200
commitf435634a29551754d5f7303b0a60cd8fe2df2079 (patch)
treef0c33d03dc692f5d2108b78f2bd898206bf4dfe7 /src/nix-store
parentb7ea98bf3409a29bb6412c6a17a896ba1c1f524a (diff)
parentb226b5cd976ca71abb3c0861b56d5e5940430924 (diff)
Merge pull request #3041 from zimbatm/nix-store-error-13
Fix for `unknown serve command 13`
Diffstat (limited to 'src/nix-store')
-rw-r--r--src/nix-store/nix-store.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index f324056bb..0cbceb02f 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -950,8 +950,16 @@ static void opServe(Strings opFlags, Strings opArgs)
info.sigs = readStrings<StringSet>(in);
in >> info.ca;
- // FIXME: race if addToStore doesn't read source?
- store->addToStore(info, in, NoRepair, NoCheckSigs);
+ if (info.narSize == 0) {
+ throw Error("narInfo is too old and missing the narSize field");
+ }
+
+ SizedSource sizedSource(in, info.narSize);
+
+ store->addToStore(info, sizedSource, NoRepair, NoCheckSigs);
+
+ // consume all the data that has been sent before continuing.
+ sizedSource.drainAll();
out << 1; // indicate success