diff options
| author | Jakob Unterwurzacher | 2026-07-16 21:01:01 +0200 |
|---|---|---|
| committer | Jakob Unterwurzacher | 2026-07-16 22:07:54 +0200 |
| commit | 67e9abeb2830c517cbcbbd93de184055b2d4227b (patch) | |
| tree | a3c557cc6b0f8cf6949ebc6b135d849fdfb1ee40 | |
| parent | b89f0dc94bd83857b187a84a0d4ae127000f0b1c (diff) | |
tests/cluster: fix possible fd exhaustion
...and one typo.
| -rw-r--r-- | internal/fusefrontend/file_allocate_truncate.go | 2 | ||||
| -rw-r--r-- | tests/cluster/cluster_test.go | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/internal/fusefrontend/file_allocate_truncate.go b/internal/fusefrontend/file_allocate_truncate.go index ecef0f1..ad02041 100644 --- a/internal/fusefrontend/file_allocate_truncate.go +++ b/internal/fusefrontend/file_allocate_truncate.go @@ -126,7 +126,7 @@ func (f *File) truncate(newSize uint64) (errno syscall.Errno) { return fs.ToErrno(syscall.Ftruncate(int(f.fd.Fd()), contentenc.HeaderLen)) } // We don't have the file ID cached, so the file may be empty on disk. - // We dont't want to grow it, as this will create an all-zero header. + // We don't want to grow it, as this will create an all-zero header. fi, err := f.fd.Stat() if err != nil { return fs.ToErrno(err) diff --git a/tests/cluster/cluster_test.go b/tests/cluster/cluster_test.go index fa639b7..70a2a02 100644 --- a/tests/cluster/cluster_test.go +++ b/tests/cluster/cluster_test.go @@ -176,6 +176,10 @@ func TestConcurrentCreate(t *testing.T) { return } syscall.Unlink(path) + + // Close now (not only when the whole loop exists) to avoid exhausting fds. + // Double-close on happy path is harmless: "Close will return an error if it has already been called" + f.Close() } } |
