diff options
author | Andrew G. Morgan <morgan@kernel.org> | 2008-07-08 06:59:01 -0700 |
---|---|---|
committer | Andrew G. Morgan <morgan@kernel.org> | 2008-07-08 06:59:01 -0700 |
commit | f6c0eee763c5bd695b94a3e4249d73d785d66659 (patch) | |
tree | cc2d0ddc88773f90325e68c43dda67fb245e6be6 /contrib | |
parent | 3463a1393551bff930d19e50417e6e57f1df7324 (diff) | |
download | libcap2-f6c0eee763c5bd695b94a3e4249d73d785d66659.tar.gz |
Fix cap_copy_int(), add two functions cap_get_pid() and cap_compare()
Test new and old function with modified test.
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/Makefile | 3 | ||||
-rw-r--r-- | contrib/bug400591/Makefile | 3 | ||||
-rw-r--r-- | contrib/bug400591/bug.c | 9 |
3 files changed, 9 insertions, 6 deletions
diff --git a/contrib/Makefile b/contrib/Makefile new file mode 100644 index 0000000..4749630 --- /dev/null +++ b/contrib/Makefile @@ -0,0 +1,3 @@ +.PHONY: all clean +all clean: + for x in bug* ; do make -C $$x $@ || exit 1 ; done diff --git a/contrib/bug400591/Makefile b/contrib/bug400591/Makefile index f6e0ea3..320610c 100644 --- a/contrib/bug400591/Makefile +++ b/contrib/bug400591/Makefile @@ -2,7 +2,8 @@ all: bug bug: bug.c ../../libcap Makefile make -C ../../libcap - cc --static -o $@ $< -L../../libcap -lcap + cc -g -I../../libcap/include --static -o $@ $< -L../../libcap -lcap + ./bug clean: rm -f bug.o bug diff --git a/contrib/bug400591/bug.c b/contrib/bug400591/bug.c index 363ca27..2ff2355 100644 --- a/contrib/bug400591/bug.c +++ b/contrib/bug400591/bug.c @@ -15,10 +15,7 @@ int main (int argc, char *argv[]) void *buffer; char *text1, *text2; - caps = cap_init(); - assert (caps); - - assert(capgetp(1, caps) == 0); + assert((caps = cap_get_pid(1))); text1 = cap_to_text(caps, NULL); assert(text1); @@ -35,10 +32,12 @@ int main (int argc, char *argv[]) caps2 = cap_copy_int(buffer); assert (caps2); - text2 = cap_to_text(caps, NULL); + text2 = cap_to_text(caps2, NULL); assert(text2); assert(strcmp(text1, text2) == 0); + assert(cap_compare(caps, caps2) == 0); + return 0; } |