aboutsummaryrefslogtreecommitdiff
path: root/libcap/cap_proc.c
diff options
context:
space:
mode:
authorAndrew Morgan <morgan@kernel.org>2007-10-31 23:18:09 -0700
committerJorge Lucangeli Obes <jorgelo@google.com>2015-09-03 14:13:03 -0700
commit32423d46c83c639c2df7db7ee74b8ec7be2b1234 (patch)
treee54994e1dbb4f23a7dbdf3233486d24d035c11dd /libcap/cap_proc.c
parentcfb5b56050a169ccb9744a886dc44d56eefdfea4 (diff)
downloadlibcap-32423d46c83c639c2df7db7ee74b8ec7be2b1234.tar.gz
Add support for 64-bit (file) capabilities
This should compile with any iteration of a recent (2.6) kernel. If your kernel has 64-bit capabilities support, and the kernel headers indicate this, then it will include that. 32-bit legacy kernel support is dynamically performed by such a build of libcap.
Diffstat (limited to 'libcap/cap_proc.c')
-rw-r--r--libcap/cap_proc.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libcap/cap_proc.c b/libcap/cap_proc.c
index 5c2ac48..40793b4 100644
--- a/libcap/cap_proc.c
+++ b/libcap/cap_proc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-8 Andrew G Morgan <morgan@kernel.org>
+ * Copyright (c) 1997-8,2007 Andrew G Morgan <morgan@kernel.org>
*
* This file deals with setting capabilities on processes.
*/
@@ -16,7 +16,7 @@ cap_t cap_get_proc(void)
_cap_debug("getting current process' capabilities");
/* fill the capability sets via a system call */
- if (capget(&result->head, &result->set)) {
+ if (capget(&result->head, &result->u[0].set)) {
cap_free(result);
result = NULL;
}
@@ -35,9 +35,8 @@ int cap_set_proc(cap_t cap_d)
}
_cap_debug("setting process capabilities");
- retval = capset(&cap_d->head, &cap_d->set);
+ retval = capset(&cap_d->head, &cap_d->u[0].set);
- cap_d->head.version = _LINUX_CAPABILITY_VERSION;
return retval;
}
@@ -57,8 +56,7 @@ int capgetp(pid_t pid, cap_t cap_d)
_cap_debug("getting process capabilities for proc %d", pid);
cap_d->head.pid = pid;
- error = capget(&cap_d->head, &cap_d->set);
- cap_d->head.version = _LINUX_CAPABILITY_VERSION;
+ error = capget(&cap_d->head, &cap_d->u[0].set);
cap_d->head.pid = 0;
return error;
@@ -77,7 +75,7 @@ int capsetp(pid_t pid, cap_t cap_d)
_cap_debug("setting process capabilities for proc %d", pid);
cap_d->head.pid = pid;
- error = capset(&cap_d->head, &cap_d->set);
+ error = capset(&cap_d->head, &cap_d->u[0].set);
cap_d->head.version = _LINUX_CAPABILITY_VERSION;
cap_d->head.pid = 0;