Browse code

vendor: update opencontainers/selinux v1.3.1

full diff: https://github.com/opencontainers/selinux/compare/5215b1806f52b1fcc2070a8826c542c9d33cd3cf...v1.3.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2020/02/20 22:40:25
Showing 3 changed files
... ...
@@ -161,6 +161,6 @@ github.com/morikuni/aec                             39771216ff4c63d11f5e604076f9
161 161
 # metrics
162 162
 github.com/docker/go-metrics                        b619b3592b65de4f087d9f16863a7e6ff905973c # v0.0.1
163 163
 
164
-github.com/opencontainers/selinux                   5215b1806f52b1fcc2070a8826c542c9d33cd3cf
164
+github.com/opencontainers/selinux                   4defb1c884d2f4f9c890c615380f20f7fc215cf3 # v1.3.1
165 165
 
166 166
 # DO NOT EDIT BELOW THIS LINE -------- reserved for downstream projects --------
... ...
@@ -7,7 +7,6 @@ import (
7 7
 	"bytes"
8 8
 	"crypto/rand"
9 9
 	"encoding/binary"
10
-	"errors"
11 10
 	"fmt"
12 11
 	"io"
13 12
 	"io/ioutil"
... ...
@@ -19,6 +18,7 @@ import (
19 19
 	"sync"
20 20
 	"syscall"
21 21
 
22
+	"github.com/pkg/errors"
22 23
 	"golang.org/x/sys/unix"
23 24
 )
24 25
 
... ...
@@ -289,7 +289,10 @@ func SetFileLabel(fpath string, label string) error {
289 289
 	if fpath == "" {
290 290
 		return ErrEmptyPath
291 291
 	}
292
-	return lsetxattr(fpath, xattrNameSelinux, []byte(label), 0)
292
+	if err := lsetxattr(fpath, xattrNameSelinux, []byte(label), 0); err != nil {
293
+		return errors.Wrapf(err, "failed to set file label on %s", fpath)
294
+	}
295
+	return nil
293 296
 }
294 297
 
295 298
 // FileLabel returns the SELinux label for this path or returns an error.
... ...
@@ -370,7 +373,10 @@ func writeCon(fpath string, val string) error {
370 370
 	} else {
371 371
 		_, err = out.Write(nil)
372 372
 	}
373
-	return err
373
+	if err != nil {
374
+		return errors.Wrapf(err, "failed to set %s on procfs", fpath)
375
+	}
376
+	return nil
374 377
 }
375 378
 
376 379
 /*
377 380
new file mode 100644
... ...
@@ -0,0 +1,8 @@
0
+module github.com/opencontainers/selinux
1
+
2
+go 1.13
3
+
4
+require (
5
+	github.com/pkg/errors v0.8.1
6
+	golang.org/x/sys v0.0.0-20191115151921-52ab43148777
7
+)