2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 05:48:05 +00:00

zdtm: check bset in caps00

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin 2013-04-24 10:46:21 +04:00 committed by Pavel Emelyanov
parent 803321abf6
commit 42d861bb48

View File

@ -2,6 +2,8 @@
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/prctl.h>
#include <linux/capability.h>
#include "zdtmtst.h" #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[_LINUX_CAPABILITY_U32S_3];
struct cap_data data_2[_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.version = _LINUX_CAPABILITY_VERSION_3;
hdr.pid = 0; hdr.pid = 0;
@ -114,6 +121,11 @@ int main(int argc, char **argv)
goto bad; goto bad;
} }
if (prctl(PR_CAPBSET_READ, CAP_SETPCAP, 0, 0, 0) != 0) {
res='5';
goto bad;
}
res = '0'; res = '0';
bad: bad:
write(result_pipe[1], &res, 1); write(result_pipe[1], &res, 1);