File tree Expand file tree Collapse file tree
lib/asimov-snapshot/src/storage Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// This is free and unencumbered software released into the public domain.
22
3- use cap_std:: fs:: { Permissions , PermissionsExt as _} ;
43use jiff:: Timestamp ;
54use std:: {
65 format,
@@ -48,7 +47,11 @@ impl super::Storage for Fs {
4847 tracing:: debug!( "Writing snapshot" ) ;
4948 let mut snapshot_file = self . root . create ( & snapshot_path) ?;
5049 snapshot_file. write_all ( data. as_ref ( ) ) ?;
51- snapshot_file. set_permissions ( Permissions :: from_mode ( 0o444 ) ) ?;
50+
51+ tracing:: debug!( "Setting snapshot file permissions" ) ;
52+ let mut permissions = snapshot_file. metadata ( ) ?. permissions ( ) ;
53+ permissions. set_readonly ( true ) ;
54+ snapshot_file. set_permissions ( permissions) ?;
5255
5356 let url_path = url_dir. join ( ".url" ) ;
5457
@@ -61,7 +64,11 @@ impl super::Storage for Fs {
6164 tracing:: debug!( path = ?url_path, "Creating `url` metadata file" ) ;
6265 let mut url_file = self . root . create ( & url_path) ?;
6366 url_file. write_all ( url. as_ref ( ) . as_bytes ( ) ) ?;
64- url_file. set_permissions ( Permissions :: from_mode ( 0o444 ) ) ?;
67+
68+ tracing:: debug!( "Setting `url` metadata file permissions" ) ;
69+ let mut permissions = url_file. metadata ( ) ?. permissions ( ) ;
70+ permissions. set_readonly ( true ) ;
71+ url_file. set_permissions ( permissions) ?;
6572 }
6673
6774 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments