v2v: vddk: Atomicly chmod the password file.

Ensure we are chmodding the correct file, avoids possible races.

Thanks: Pino Toscano.
This commit is contained in:
Richard W.M. Jones
2017-11-16 12:31:41 +00:00
parent 2d1e2d12af
commit d17a70324c

View File

@@ -243,7 +243,7 @@ object
let password_file = tmpdir // "password" in
with_open_out password_file (
fun chan ->
chmod password_file 0o600;
fchmod (descr_of_out_channel chan) 0o600;
output_string chan password
);
(* nbdkit reads the password from the file *)