From 42d861bb488d9f1f70ea41d61d99036737a7e70f Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Wed, 24 Apr 2013 10:46:21 +0400 Subject: [PATCH] zdtm: check bset in caps00 Signed-off-by: Andrey Vagin Signed-off-by: Pavel Emelyanov --- test/zdtm/live/static/caps00.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/zdtm/live/static/caps00.c b/test/zdtm/live/static/caps00.c index 01cc1af61..beb97abee 100644 --- a/test/zdtm/live/static/caps00.c +++ b/test/zdtm/live/static/caps00.c @@ -2,6 +2,8 @@ #include #include #include +#include +#include #include "zdtmtst.h" @@ -61,6 +63,11 @@ int main(int argc, char **argv) struct cap_data data[_LINUX_CAPABILITY_U32S_3]; struct cap_data data_2[_LINUX_CAPABILITY_U32S_3]; + if (prctl(PR_CAPBSET_DROP, CAP_SETPCAP, 0, 0, 0)) { + err("PR_CAPBSET_DROP"); + return -1; + } + hdr.version = _LINUX_CAPABILITY_VERSION_3; hdr.pid = 0; @@ -114,6 +121,11 @@ int main(int argc, char **argv) goto bad; } + if (prctl(PR_CAPBSET_READ, CAP_SETPCAP, 0, 0, 0) != 0) { + res='5'; + goto bad; + } + res = '0'; bad: write(result_pipe[1], &res, 1);