summaryrefslogtreecommitdiff
path: root/libbb/selinux_common.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-10-20 02:00:49 +0000
committerDenis Vlasenko2007-10-20 02:00:49 +0000
commit2edbc2ab85b96fb01a3862db09df12f40d4382cd (patch)
tree0637a680a89fb11a986e59657875adda2546ec18 /libbb/selinux_common.c
parentaa7a888e423fc85daa8af0ac3aabe8fc7af86312 (diff)
downloadbusybox-2edbc2ab85b96fb01a3862db09df12f40d4382cd.zip
busybox-2edbc2ab85b96fb01a3862db09df12f40d4382cd.tar.gz
ping: fix breakage from -I fix
passwd: SELinux support by KaiGai Kohei <kaigai@ak.jp.nec.com>
Diffstat (limited to 'libbb/selinux_common.c')
-rw-r--r--libbb/selinux_common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libbb/selinux_common.c b/libbb/selinux_common.c
index ff076f6..7478cc7 100644
--- a/libbb/selinux_common.c
+++ b/libbb/selinux_common.c
@@ -38,3 +38,17 @@ void setfscreatecon_or_die(security_context_t scontext)
"file creation context to %s", scontext);
}
}
+
+void selinux_preserve_fcontext(int fdesc)
+{
+ security_context_t context;
+
+ if (fgetfilecon(fdesc, &context) < 0) {
+ if (errno == ENODATA || errno == ENOTSUP)
+ return;
+ bb_perror_msg_and_die("fgetfilecon failed");
+ }
+ setfscreatecon_or_die(context);
+ freecon(context);
+}
+