diff --git a/Makefile b/Makefile index 3701d351..d37c8cef 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +.SHELLFLAGS = -ec PACKAGES ?= mountinfo mount BINDIR ?= _build/bin diff --git a/mountinfo/mountinfo_linux.go b/mountinfo/mountinfo_linux.go index 20630248..cdfd37da 100644 --- a/mountinfo/mountinfo_linux.go +++ b/mountinfo/mountinfo_linux.go @@ -193,10 +193,10 @@ func unescape(path string) (string, error) { case '0', '1', '2', '3', '4', '5', '6', '7': v := c - '0' for j := 2; j < 4; j++ { // one digit already; two more - x := s[j] - '0' - if x < 0 || x > 7 { + if s[j] < '0' || s[j] > '7' { return "", fmt.Errorf("bad escape sequence %q: not a digit", s[:3]) } + x := s[j] - '0' v = (v << 3) | x } if v > 255 { diff --git a/mountinfo/mountinfo_linux_test.go b/mountinfo/mountinfo_linux_test.go index 7c060e2f..868bad90 100644 --- a/mountinfo/mountinfo_linux_test.go +++ b/mountinfo/mountinfo_linux_test.go @@ -509,7 +509,7 @@ func TestParseMountinfoWithSpaces(t *testing.T) { Opts: "rw,relatime", Optional: "", Fstype: "cifs", - Source: `//foo/BLA\040BLA\040BLA/`, + Source: `//foo/BLA BLA BLA/`, VfsOpts: `rw,sec=ntlm,cache=loose,unc=\\foo\BLA`, }, {