1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 10:31:15 +02:00

Replace a few bool flags with enums

Functions like copyClosure() had 3 bool arguments, which creates a
severe risk of mixing up arguments.

Also, implement copyClosure() using copyPaths().
This commit is contained in:
Eelco Dolstra 2017-06-28 18:11:01 +02:00
parent 90da34e421
commit fcca702a96
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
22 changed files with 144 additions and 147 deletions

View file

@ -304,7 +304,7 @@ static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVe
string s = readString(from);
PathSet refs = readStorePaths<PathSet>(*store, from);
startWork();
Path path = store->addTextToStore(suffix, s, refs, false);
Path path = store->addTextToStore(suffix, s, refs, NoRepair);
stopWork();
to << path;
break;
@ -324,7 +324,8 @@ static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVe
case wopImportPaths: {
startWork();
TunnelSource source(from);
Paths paths = store->importPaths(source, 0, trusted);
Paths paths = store->importPaths(source, nullptr,
trusted ? NoCheckSigs : CheckSigs);
stopWork();
to << paths;
break;
@ -576,7 +577,7 @@ static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVe
startWork();
if (repair && !trusted)
throw Error("you are not privileged to repair paths");
bool errors = store->verifyStore(checkContents, repair);
bool errors = store->verifyStore(checkContents, (RepairFlag) repair);
stopWork();
to << errors;
break;
@ -623,7 +624,8 @@ static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVe
parseDump(tee, tee.source);
startWork();
store->addToStore(info, tee.source.data, repair, dontCheckSigs, nullptr);
store->addToStore(info, tee.source.data, (RepairFlag) repair,
dontCheckSigs ? NoCheckSigs : CheckSigs, nullptr);
stopWork();
break;
}