aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-06-05 17:18:12 +0200
committerGitHub <noreply@github.com>2020-06-05 17:18:12 +0200
commitd558fb98f6f8ce32e5c08a36d798441f1b941ba8 (patch)
tree83fed43570e49a30072eec45fbfd08df6a4113ff
parent39e84c35d0b8bf5b49f45736febd9f506e3ee4ae (diff)
parent2299ef705c2d69add371ee4ccca04de9f2628853 (diff)
Merge pull request #3656 from obsidiansystems/handle-unknown-file-ingestion
Add error message when FileIngestionMethod is out of bounds
-rw-r--r--src/libstore/daemon.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc
index f1afdff69..5cff170dd 100644
--- a/src/libstore/daemon.cc
+++ b/src/libstore/daemon.cc
@@ -358,8 +358,10 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
std::string s, baseName;
FileIngestionMethod method;
{
- bool fixed, recursive;
+ bool fixed; uint8_t recursive;
from >> baseName >> fixed /* obsolete */ >> recursive >> s;
+ if (recursive > (uint8_t) FileIngestionMethod::Recursive)
+ throw Error("unsupported FileIngestionMethod with value of %i; you may need to upgrade nix-daemon", recursive);
method = FileIngestionMethod { recursive };
/* Compatibility hack. */
if (!fixed) {