param export: use writer lock

to protect against concurrent writes to the same file
This commit is contained in:
Beat Küng
2017-03-24 17:00:27 +01:00
committed by Lorenz Meier
parent a5cdff06d5
commit f3e9739ab0
+2 -2
View File
@@ -1004,7 +1004,7 @@ param_export(int fd, bool only_unsaved)
struct bson_encoder_s encoder;
int result = -1;
param_lock_reader();
param_lock_writer();
param_bus_lock(true);
bson_encoder_init_file(&encoder, fd);
@@ -1102,7 +1102,7 @@ param_export(int fd, bool only_unsaved)
result = 0;
out:
param_unlock_reader();
param_unlock_writer();
if (result == 0) {
result = bson_encoder_fini(&encoder);