]> Cypherpunks repositories - gostls13.git/commitdiff
os: deal with chmod error for TestRootConsistencyChmod
authorJes Cok <xigua67damn@gmail.com>
Mon, 17 Feb 2025 11:45:51 +0000 (11:45 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 18 Feb 2025 17:27:42 +0000 (09:27 -0800)
Previously the error returned by chmod has not actually been used.

Change-Id: I97c947a2278a084c58784fd100630ce2a54bfb03
GitHub-Last-Rev: ddc60a044f641d264c9ee88d87b2da7e2f766741
GitHub-Pull-Request: golang/go#71744
Reviewed-on: https://go-review.googlesource.com/c/go/+/649418
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

src/os/root_test.go

index 3591214ffd7043a2922f2f45af8064660f57797c..a7ea0025ecc8106e97155426a131d5929d660055 100644 (file)
@@ -928,12 +928,16 @@ func TestRootConsistencyChmod(t *testing.T) {
                        }
 
                        var m1, m2 os.FileMode
-                       err := chmod(path, 0o555)
+                       if err := chmod(path, 0o555); err != nil {
+                               return "chmod 0o555", err
+                       }
                        fi, err := lstat(path)
                        if err == nil {
                                m1 = fi.Mode()
                        }
-                       err = chmod(path, 0o777)
+                       if err = chmod(path, 0o777); err != nil {
+                               return "chmod 0o777", err
+                       }
                        fi, err = lstat(path)
                        if err == nil {
                                m2 = fi.Mode()