mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-10-14 18:07:43 +00:00
libpod/events: use filepath.Dir for consistency in truncate()
The truncate() function in libpod/events/logfile.go used path.Dir on a filesystem path (filePath). The file is Linux/FreeBSD only per its build tag, so this isn't about Windows correctness — it's about internal consistency: the same file already calls filepath.Dir at line 32 for the same kind of path handling, and filepath is idiomatic for filesystem operations. Also removes the now-unused 'path' import. Fixes part of #25165 Signed-off-by: Shreya Vidyadhar <shrevidh03@gmail.com>
This commit is contained in:
parent
55c2d1c490
commit
f03c385dcd
1 changed files with 1 additions and 2 deletions
|
|
@ -9,7 +9,6 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
|
|
@ -287,7 +286,7 @@ func truncate(filePath string) error {
|
|||
size := origFinfo.Size()
|
||||
threshold := size / 2
|
||||
|
||||
tmp, err := os.CreateTemp(path.Dir(filePath), "")
|
||||
tmp, err := os.CreateTemp(filepath.Dir(filePath), "")
|
||||
if err != nil {
|
||||
// Retry in /tmp in case creating a tmp file in the same
|
||||
// directory has failed.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue