Improved capability setting code
This patch should make set_cap() more error-prone and correct.
(1) Add defines for _LINUX_CAPABILITY_VERSION_* in case of old headers
during compilation
(2) Do not set version before doing getcap(). This helps to eliminate
the following kernel warning:
warning: `vzctl' uses 32-bit capabilities (legacy support in use)
(3) Check version returned by getcap(); fail with ENOSYS if we don't
recognize it (meaning the kernel is way too new for us).
(4) Enlarge data size to match VERSION_3 size (although upper words
are not yet used).
Big thanks to avagin@ who pointed out to this and helped to untangle.
Reported-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
1 file changed