aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_fs_cat.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-02-07 23:08:54 -0800
committerchrislu <chris.lu@gmail.com>2022-02-07 23:08:54 -0800
commit85c1615b435c4d7fb87b30fbe6cde4599d555b62 (patch)
tree45aba53786b2d71d6668d559c09aa6d22632f80a /weed/shell/command_fs_cat.go
parentb1cff07ab0541200b26d345d1d396fddcba66d79 (diff)
downloadseaweedfs-85c1615b435c4d7fb87b30fbe6cde4599d555b62.tar.xz
seaweedfs-85c1615b435c4d7fb87b30fbe6cde4599d555b62.zip
filer read empty file may cause OOM in some cases
fix https://github.com/chrislusf/seaweedfs/issues/2641
Diffstat (limited to 'weed/shell/command_fs_cat.go')
-rw-r--r--weed/shell/command_fs_cat.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/weed/shell/command_fs_cat.go b/weed/shell/command_fs_cat.go
index 17e9c6550..16be25ee5 100644
--- a/weed/shell/command_fs_cat.go
+++ b/weed/shell/command_fs_cat.go
@@ -2,12 +2,10 @@ package shell
import (
"fmt"
- "io"
- "math"
-
"github.com/chrislusf/seaweedfs/weed/filer"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/util"
+ "io"
)
func init() {
@@ -57,7 +55,7 @@ func (c *commandFsCat) Do(args []string, commandEnv *CommandEnv, writer io.Write
return err
}
- return filer.StreamContent(commandEnv.MasterClient, writer, respLookupEntry.Entry.Chunks, 0, math.MaxInt64)
+ return filer.StreamContent(commandEnv.MasterClient, writer, respLookupEntry.Entry.Chunks, 0, int64(filer.FileSize(respLookupEntry.Entry)))
})