aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-07-11 16:06:24 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-07-14 13:54:29 +0000
commit9ec10046e04a509cc982102f587cf06840f02327 (patch)
tree3d52a137dc86c7137545625e96a729d4f54cdf38 /src/libstore
parent926c3a6664a9dfb288ca35af8aae40c4e4a2badb (diff)
Narrow scope of temporary value
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/daemon.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc
index db7139374..6e0b290ed 100644
--- a/src/libstore/daemon.cc
+++ b/src/libstore/daemon.cc
@@ -375,21 +375,24 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
}
case wopAddToStore: {
- std::string s, baseName;
+ HashType hashAlgo;
+ std::string baseName;
FileIngestionMethod method;
{
- bool fixed; uint8_t recursive;
- from >> baseName >> fixed /* obsolete */ >> recursive >> s;
+ bool fixed;
+ uint8_t recursive;
+ std::string hashAlgoRaw;
+ from >> baseName >> fixed /* obsolete */ >> recursive >> hashAlgoRaw;
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) {
- s = "sha256";
+ hashAlgoRaw = "sha256";
method = FileIngestionMethod::Recursive;
}
+ hashAlgo = parseHashType(hashAlgoRaw);
}
- HashType hashAlgo = parseHashType(s);
StringSink savedNAR;
TeeSource savedNARSource(from, savedNAR);