cmd/makemac: check slice length in isFileSystemReadOnly before access

This is a followup to CL 181217 to address a minor code review comment.
Check the slice length before access, to prevent a possible panic on
unexpected input.

Also improve error string to not end with punctuation, per style guide
entry at golang.org/s/style#error-strings.

Change-Id: I220f6744396740b0e7f92705367be56c83ee23da
Reviewed-on: https://go-review.googlesource.com/c/build/+/182337
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
diff --git a/cmd/makemac/makemac.go b/cmd/makemac/makemac.go
index 0fe9cd3..46a1013 100644
--- a/cmd/makemac/makemac.go
+++ b/cmd/makemac/makemac.go
@@ -501,7 +501,7 @@
 	}
 	vm := ret.VirtualMachines[0]
 	if len(vm.Layout.Snapshot) < 1 {
-		return "", fmt.Errorf("VM %s does not have any snapshots. Needs at least one.", vmName)
+		return "", fmt.Errorf("VM %s does not have any snapshots; needs at least one", vmName)
 	}
 	ss := vm.Layout.Snapshot[len(vm.Layout.Snapshot)-1] // most recent snapshot is last in list
 
@@ -860,6 +860,9 @@
 	bs := bufio.NewScanner(f)
 	for bs.Scan() {
 		f := strings.Fields(bs.Text())
+		if len(f) < 4 {
+			continue
+		}
 		mountPoint, state := f[1], f[3]
 		if mountPoint == "/" {
 			return strings.HasPrefix(state, "ro,")