commit 9d3499d9f33f98776fe06479a43da5eafaea2e7f from: Stephen J Day date: Fri Oct 30 04:35:49 2015 UTC fs/p9p/new: fix cat command in 9pr Signed-off-by: Stephen J Day commit - 25c156598b90f01e3b80c2b1ddb8ab8c913d1139 commit + 9d3499d9f33f98776fe06479a43da5eafaea2e7f blob - c3dc81061964b298f379e9139ccf77ae9781000f blob + 25b2080e9f954172c4073e32232291a5f7030dbb --- cmd/9pr/main.go +++ cmd/9pr/main.go @@ -305,13 +305,18 @@ func (c *fsCommander) cmdcat(ctx context.Context, args } defer c.session.Clunk(ctx, c.pwdfid) - _, msize, err := c.session.Open(ctx, targetfid, p9pnew.OREAD) + _, iounit, err := c.session.Open(ctx, targetfid, p9pnew.OREAD) if err != nil { return err } - b := make([]byte, msize) + if iounit < 1 { + msize, _ := c.session.Version() + iounit = msize - 24 // size of message max minus fcall io header (Rread) + } + b := make([]byte, iounit) + n, err := c.session.Read(ctx, targetfid, b, 0) if err != nil { return err