@@ -155,6 +155,7 @@ fn test_fchdir() {
155
155
// fchdir changes the process's cwd
156
156
#[ allow( unused_variables) ]
157
157
let m = :: CWD_MTX . lock ( ) . expect ( "Mutex got poisoned by another test" ) ;
158
+
158
159
let tmpdir = TempDir :: new ( "test_fchdir" ) . unwrap ( ) ;
159
160
let tmpdir_path = tmpdir. path ( ) . canonicalize ( ) . unwrap ( ) ;
160
161
let tmpdir_fd = File :: open ( & tmpdir_path) . unwrap ( ) . into_raw_fd ( ) ;
@@ -170,15 +171,17 @@ fn test_getcwd() {
170
171
// chdir changes the process's cwd
171
172
#[ allow( unused_variables) ]
172
173
let m = :: CWD_MTX . lock ( ) . expect ( "Mutex got poisoned by another test" ) ;
173
- let tmp_dir = TempDir :: new ( "test_getcwd" ) . unwrap ( ) ;
174
- assert ! ( chdir( tmp_dir. path( ) ) . is_ok( ) ) ;
175
- assert_eq ! ( getcwd( ) . unwrap( ) , tmp_dir. path( ) ) ;
174
+
175
+ let tmpdir = TempDir :: new ( "test_getcwd" ) . unwrap ( ) ;
176
+ let tmpdir_path = tmpdir. path ( ) . canonicalize ( ) . unwrap ( ) ;
177
+ assert ! ( chdir( & tmpdir_path) . is_ok( ) ) ;
178
+ assert_eq ! ( getcwd( ) . unwrap( ) , tmpdir_path) ;
176
179
177
180
// make path 500 chars longer so that buffer doubling in getcwd
178
181
// kicks in. Note: One path cannot be longer than 255 bytes
179
182
// (NAME_MAX) whole path cannot be longer than PATH_MAX (usually
180
183
// 4096 on linux, 1024 on macos)
181
- let mut inner_tmp_dir = tmp_dir . path ( ) . to_path_buf ( ) ;
184
+ let mut inner_tmp_dir = tmpdir_path . to_path_buf ( ) ;
182
185
for _ in 0 ..5 {
183
186
let newdir = iter:: repeat ( "a" ) . take ( 100 ) . collect :: < String > ( ) ;
184
187
inner_tmp_dir. push ( newdir) ;
0 commit comments