gentoo/sys-apps/coreutils/files/coreutils-8.22-selinux-cont...

19 lines
694 B
Diff

X-Git-Url: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blobdiff_plain;f=src%2Fselinux.c;h=016db162604c2b618e3ae19377698265bc3a7120;hp=cd38a81e846aab10aa66ff75c1c6968c75a1f4ae;hb=d718331e59afb35e56445f3a1597ed74a7f3a3e2;hpb=ba25b75dc2a4f37cb65b5e2ff1bf41bd1707770b
diff --git a/src/selinux.c b/src/selinux.c
index cd38a81..016db16 100644
--- a/src/selinux.c
+++ b/src/selinux.c
@@ -192,6 +192,11 @@ restorecon_private (char const *path, bool local)
{
if (getfscreatecon (&tcon) < 0)
return rc;
+ if (!tcon)
+ {
+ errno = ENODATA;
+ return rc;
+ }
rc = lsetfilecon (path, tcon);
freecon (tcon);
return rc;