python-pathvalidate: bump version to 0.14.1
[buildroot-gz.git] / package / libcap / 0003-libcap-cap_file.c-fix-build-with-old-kernel-headers.patch
blob02cc228b1df6a14737a34d2fbd12ebd2ee39bd73
1 From ace694e9574eb38e07cfe0db235434eb40003f47 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Mon, 14 Mar 2016 22:39:15 +0100
4 Subject: [PATCH] libcap/cap_file.c: fix build with old kernel headers
6 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
7 ---
8 libcap/cap_file.c | 27 +++++++++++++++++++++++++++
9 1 file changed, 27 insertions(+)
11 diff --git a/libcap/cap_file.c b/libcap/cap_file.c
12 index 40756ea..e3d54dd 100644
13 --- a/libcap/cap_file.c
14 +++ b/libcap/cap_file.c
15 @@ -23,6 +23,33 @@ extern int fsetxattr(int, const char *, const void *, size_t, int);
16 extern int removexattr(const char *, const char *);
17 extern int fremovexattr(int, const char *);
20 +/*
21 + * Old kernels (before 2.6.36) were defining XATTR_NAME_CAPS in
22 + * <linux/capability.h>, but using XATTR_SECURITY_PREFIX and
23 + * XATTR_CAPS_SUFFIX which were defined in the kernel-only part of
24 + * <linux/xattr.h>.
25 + *
26 + * In kernel 2.6.36 (commit af4f136056c984b0aa67feed7d3170b958370b2f),
27 + * the XATTR_NAME_CAPS definition was moved to the kernel-only part of
28 + * <linux/xattr.h>. It's only in kernel 3.0 (commit
29 + * 1dbe39424a43e56a6c9aed12661192af51dcdb9f) that <linux/xattr.h> was
30 + * fixed to expose XATTR_NAME_CAPS and the related definitions to
31 + * userspace.
32 + *
33 + * In order to cope with kernels < 3.0, we define here the appropriate
34 + * values, which we assume haven't changed over history.
35 + */
36 +#ifndef XATTR_CAPS_SUFFIX
37 +#define XATTR_CAPS_SUFFIX "capability"
38 +#endif
39 +#ifndef XATTR_SECURITY_PREFIX
40 +#define XATTR_SECURITY_PREFIX "security."
41 +#endif
42 +#ifndef XATTR_NAME_CAPS
43 +#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
44 +#endif
46 #include "libcap.h"
48 #ifdef VFS_CAP_U32
49 --
50 2.6.4