File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -492,7 +492,11 @@ impl EnvUniversal {
492
492
res_fd
493
493
}
494
494
495
- fn open_temporary_file ( & mut self , directory : & wstr , out_path : & mut WString ) -> OwnedFd {
495
+ fn open_temporary_file (
496
+ & mut self ,
497
+ directory : & wstr ,
498
+ out_path : & mut WString ,
499
+ ) -> Result < OwnedFd , Errno > {
496
500
// Create and open a temporary file for writing within the given directory. Try to create a
497
501
// temporary file, up to 10 times. We don't use mkstemps because we want to open it CLO_EXEC.
498
502
// This should almost always succeed on the first try.
@@ -518,13 +522,14 @@ impl EnvUniversal {
518
522
e. to_string( )
519
523
)
520
524
) ;
525
+ return Err ( e) ;
521
526
}
522
527
_ => continue ,
523
528
}
524
529
} ;
525
530
526
531
* out_path = str2wcstring ( result. 1 . as_bytes ( ) ) ;
527
- result. 0
532
+ Ok ( result. 0 )
528
533
}
529
534
530
535
/// Writes our state to the fd. path is provided only for error reporting.
@@ -753,7 +758,9 @@ impl EnvUniversal {
753
758
754
759
// Open adjacent temporary file.
755
760
let mut private_file_path = WString :: new ( ) ;
756
- let private_fd = self . open_temporary_file ( directory, & mut private_file_path) ;
761
+ let Ok ( private_fd) = self . open_temporary_file ( directory, & mut private_file_path) else {
762
+ return false ;
763
+ } ;
757
764
// unlink pfp upon failure. In case of success, it (already) won't exist.
758
765
let delete_pfp = ScopeGuard :: new ( private_file_path, |path| {
759
766
wunlink ( path) ;
You can’t perform that action at this time.
0 commit comments