Skip to content

Commit

Permalink
defer close the rotated log open
Browse files Browse the repository at this point in the history
  • Loading branch information
rphillips committed Nov 12, 2021
1 parent 82e6210 commit 47a2215
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/kubelet/kuberuntime/logs/logs.go
Expand Up @@ -359,6 +359,7 @@ func ReadLogs(ctx context.Context, path, containerID string, opts *LogOptions, r
}
return fmt.Errorf("failed to open log file %q: %v", path, err)
}
defer newF.Close()
f.Close()
if err := watcher.Remove(f.Name()); err != nil && !os.IsNotExist(err) {
klog.Errorf("failed to remove file watch %q: %v", f.Name(), err)
Expand Down

0 comments on commit 47a2215

Please sign in to comment.