File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1245,12 +1245,6 @@ impl Config {
12451245 }
12461246 }
12471247
1248- if self . system . user . uid == 0 || self . system . user . gid == 0 {
1249- return Err ( anyhow:: anyhow!(
1250- "refusing to create user with UID or GID of 0 (root), please check your wings config and change system.username to a non-root user"
1251- ) ) ;
1252- }
1253-
12541248 let command = if release. contains ( "alpine" ) {
12551249 std:: process:: Command :: new ( "addgroup" )
12561250 . arg ( "-S" )
@@ -1300,6 +1294,12 @@ impl Config {
13001294 self . system . user . uid = * * user. id ( ) ;
13011295 self . system . user . gid = * user. group_id ( ) ;
13021296
1297+ if self . system . user . uid == 0 || self . system . user . gid == 0 {
1298+ return Err ( anyhow:: anyhow!(
1299+ "refusing to use user with UID or GID of 0 (root), please check your wings config and change system.username to a non-root user"
1300+ ) ) ;
1301+ }
1302+
13031303 Ok ( ( ) )
13041304 }
13051305
Original file line number Diff line number Diff line change @@ -708,18 +708,18 @@ impl Filesystem {
708708 metadata. len ( )
709709 } ;
710710
711- self . async_allocate_in_path ( & path, -( size as i64 ) , false )
712- . await ;
713-
714711 if metadata. is_dir ( ) {
715- let mut disk_usage = self . disk_usage . write ( ) . await ;
716- disk_usage. remove_path ( & path) ;
712+ self . async_remove_dir_all ( & path) . await ?;
713+ } else {
714+ self . async_remove_file ( & path) . await ?;
717715 }
718716
719717 if metadata. is_dir ( ) {
720- self . async_remove_dir_all ( path) . await ?;
721- } else {
722- self . async_remove_file ( path) . await ?;
718+ let mut disk_usage = self . disk_usage . write ( ) . await ;
719+ disk_usage. remove_path ( & path) ;
720+ } else if let Some ( parent) = path. parent ( ) {
721+ self . async_allocate_in_path ( parent, -( size as i64 ) , false )
722+ . await ;
723723 }
724724
725725 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments