mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-27 19:35:32 +00:00
runtime: fix the bug of func countFiles
When the total number of files observed is greater than limit, return (-1, err). When the returned err is not nil, the func countFiles should return -1. Fixes:#9780 Signed-off-by: gaohuatao <gaohuatao@bytedance.com>
This commit is contained in:
parent
b30d085271
commit
638e9acf89
@ -388,7 +388,11 @@ func countFiles(path string, limit int) (numFiles int, err error) {
|
||||
if file.IsDir() {
|
||||
inc, err := countFiles(filepath.Join(path, file.Name()), (limit - numFiles))
|
||||
if err != nil {
|
||||
return numFiles, err
|
||||
return 0, err
|
||||
}
|
||||
// exceeded limit
|
||||
if inc == -1 {
|
||||
return -1, nil
|
||||
}
|
||||
numFiles = numFiles + inc
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user