Skip to content

Commit 1c6149d

Browse files
authored
Merge pull request #199 from Byron/fix-error
fix: don't claim 'too many temporary files exist' if a file already existed, once.
2 parents 37fe36b + 2d3fdd6 commit 1c6149d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ where
3434
for _ in 0..num_retries {
3535
let path = base.join(tmpname(prefix, suffix, random_len));
3636
return match f(path) {
37-
Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists => continue,
37+
Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists && num_retries > 1 => continue,
3838
// AddrInUse can happen if we're creating a UNIX domain socket and
3939
// the path already exists.
40-
Err(ref e) if e.kind() == io::ErrorKind::AddrInUse => continue,
40+
Err(ref e) if e.kind() == io::ErrorKind::AddrInUse && num_retries > 1 => continue,
4141
res => res,
4242
};
4343
}

0 commit comments

Comments
 (0)