Skip to content

Commit

Permalink
merge #30 into cyphar/filepath-securejoin:main
Browse files Browse the repository at this point in the history
Aleksa Sarai (1):
  tests: make sure the directory handle is kept alive in rename loop

LGTMs: cyphar
  • Loading branch information
cyphar committed Sep 30, 2024
2 parents 37bfb4b + 1446241 commit 3bf6419
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions util_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"testing"
Expand Down Expand Up @@ -111,6 +112,8 @@ func doRenameExchangeLoop(pauseCh chan struct{}, exitCh <-chan struct{}, dir *os
// enter a bad filesystem state if we get paused.
panic(fmt.Sprintf("renameat2([%d]%q, %q, ..., %q, RENAME_EXCHANGE) = %v", int(dir.Fd()), dir.Name(), pathA, pathB, err))
}
// Make sure GC doesn't close the directory handle.
runtime.KeepAlive(dir)
}
}
}
Expand Down

0 comments on commit 3bf6419

Please sign in to comment.