diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2020-06-03 15:18:46 -0500 |
---|---|---|
committer | Matthew Bauer <mjbauer95@gmail.com> | 2020-06-04 11:32:39 -0500 |
commit | 2299ef705c2d69add371ee4ccca04de9f2628853 (patch) | |
tree | 12e57782fcfe9d4ef4460ab2e1923c4478341004 /src | |
parent | bfa1acd85c4d15c5ea95337138f47672659e2a9e (diff) |
Add error message when FileIngestionMethod is out of bounds
bool coerces anything >0 to true, but in the future we may have other
file ingestion methods. This shows a better error message when the
“recursive” byte isn’t 1.
Diffstat (limited to 'src')
-rw-r--r-- | src/libstore/daemon.cc | 4 |
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) { |