summaryrefslogtreecommitdiff
blob: b653387a941677b5dc26d9ef3cbd9465d8969ae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From: Kir Kolyshkin <kir@openvz.org>
Date: Sat, 7 Jun 2008 14:16:46 +0000 (+0400)
Subject: Fix inability to start a container
X-Git-Url: http://git.openvz.org/?p=vzctl;a=commitdiff_plain;h=0d6bfad92c7cb6a193801ce8dac3a0dc64396ca8;hp=3223b438683eba695ecaff2be65d08cb231bb471

Fix inability to start a container

Container start could fail with the following message:

	Unable to set capability: Invalid argument

It is caused by changed value of LINUX_CAPABILITY_VERSION
(defined in /usr/include/linux/capability.h).

The fix is to get this version from kernel (as libcap-2.0.0 does).

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
---

diff --git a/src/lib/cap.c b/src/lib/cap.c
index 428bd43..67d95e3 100644
--- a/src/lib/cap.c
+++ b/src/lib/cap.c
@@ -165,6 +165,7 @@ static int set_cap(envid_t veid, cap_t mask, int pid)
 
 	memset(&header, 0, sizeof(header));
 	header.version = _LINUX_CAPABILITY_VERSION;
+	capget(&header, NULL); /* Get linux capability version from kernel */
 	header.pid = pid;
 
 	memset(&data, 0, sizeof(data));