mirror of
https://github.com/NixOS/nix
synced 2025-07-06 09:11:47 +02:00
libutil: writeFile variant for file descriptors
`writeFile` lose its `sync` boolean flag to make things simpler. A new `writeFileAndSync` function is created and all call sites are converted to it. Change-Id: Ib871a5283a9c047db1e4fe48a241506e4aab9192 Signed-off-by: Raito Bezarius <raito@lix.systems>
This commit is contained in:
parent
002d202653
commit
034f59bbb9
3 changed files with 39 additions and 13 deletions
|
@ -247,7 +247,7 @@ LocalStore::LocalStore(ref<const Config> config)
|
|||
else if (curSchema == 0) { /* new store */
|
||||
curSchema = nixSchemaVersion;
|
||||
openDB(*state, true);
|
||||
writeFile(schemaPath, fmt("%1%", curSchema), 0666, true);
|
||||
writeFileAndSync(schemaPath, fmt("%1%", curSchema), 0666);
|
||||
}
|
||||
|
||||
else if (curSchema < nixSchemaVersion) {
|
||||
|
@ -298,7 +298,7 @@ LocalStore::LocalStore(ref<const Config> config)
|
|||
txn.commit();
|
||||
}
|
||||
|
||||
writeFile(schemaPath, fmt("%1%", nixSchemaVersion), 0666, true);
|
||||
writeFileAndSync(schemaPath, fmt("%1%", nixSchemaVersion), 0666);
|
||||
|
||||
lockFile(globalLock.get(), ltRead, true);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue