From: David du Colombier <0intro@gmail.com> Date: Wed, 10 Jun 2015 20:32:14 +0000 (+0200) Subject: os: fix error returned by dirstat on Plan 9 X-Git-Tag: go1.5beta1~295 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bd8e3d028eeca723bb37f72c6d513e32c374af73;p=gostls13.git os: fix error returned by dirstat on Plan 9 When the Stat or Fstat system calls return -1, dirstat incorrectly returns ErrShortStat. However, the error returned by Stat or Fstat could be different. For example, when the file doesn't exist, they return "does not exist". Dirstat should return the error returned by the system call. Fixes #10911. Fixes #11132. Change-Id: Icf242d203d256f12366b1e277f99b1458385104a Reviewed-on: https://go-review.googlesource.com/10900 Run-TryBot: David du Colombier <0intro@gmail.com> Reviewed-by: Brad Fitzpatrick --- diff --git a/src/os/stat_plan9.go b/src/os/stat_plan9.go index 57227876f1..ddb304fd94 100644 --- a/src/os/stat_plan9.go +++ b/src/os/stat_plan9.go @@ -63,7 +63,7 @@ func dirstat(arg interface{}) (*syscall.Dir, error) { } if n < _BIT16SZ { - return nil, &PathError{"stat", name, syscall.ErrShortStat} + return nil, &PathError{"stat", name, err} } // Pull the real size out of the stat message.