diff --git a/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/deviceset.c b/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/deviceset.c index 2bf864117ee3f5e5f85f71880c3ac3851481740f..f2dbbffd2778748f4eca2ad466af73c584738eea 100644 --- a/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/deviceset.c +++ b/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/deviceset.c @@ -1140,7 +1140,7 @@ static int save_metadata(struct device_set *devset, image_devmapper_device_info goto out; } - if (util_write_file(fname, metadata_json, strlen(metadata_json), DEFAULT_SECURE_FILE_MODE) != 0) { + if (util_atomic_write_file(fname, metadata_json, strlen(metadata_json), DEFAULT_SECURE_FILE_MODE) != 0) { ret = -1; ERROR("failed write process.json"); goto out; @@ -1177,7 +1177,7 @@ static int save_transaction_metadata(struct device_set *devset) goto out; } - if (util_write_file(fname, trans_json, strlen(trans_json), DEFAULT_SECURE_FILE_MODE) != 0) { + if (util_atomic_write_file(fname, trans_json, strlen(trans_json), DEFAULT_SECURE_FILE_MODE) != 0) { ret = -1; ERROR("failed write process.json"); goto out; @@ -1222,7 +1222,7 @@ static int save_deviceset_matadata(struct device_set *devset) goto free_out; } - if (util_write_file(fname, metadata_json, strlen(metadata_json), DEFAULT_SECURE_FILE_MODE) != 0) { + if (util_atomic_write_file(fname, metadata_json, strlen(metadata_json), DEFAULT_SECURE_FILE_MODE) != 0) { ret = -1; ERROR("failed write process.json"); goto free_out;