1 /******************************************************************************/ 2 /* */ 3 /* Copyright (c) International Business Machines Corp., 2008 */ 4 /* */ 5 /* This program is free software; you can redistribute it and/or modify */ 6 /* it under the terms of the GNU General Public License as published by */ 7 /* the Free Software Foundation; either version 2 of the License, or */ 8 /* (at your option) any later version. */ 9 /* */ 10 /* This program is distributed in the hope that it will be useful, */ 11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 13 /* the GNU General Public License for more details. */ 14 /* */ 15 /* You should have received a copy of the GNU General Public License */ 16 /* along with this program; if not, write to the Free Software */ 17 /* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ 18 /* */ 19 /******************************************************************************/ 20 21 #include <stdio.h> 22 #include "config.h" 23 #if HAVE_SYS_CAPABILITY_H 24 #include <linux/types.h> 25 #include <sys/capability.h> 26 #endif 27 28 int main(void) 29 { 30 #ifdef HAVE_LIBCAP 31 cap_t caps, caps2; 32 int ret; 33 34 caps = cap_from_text("cap_setpcap+ep"); 35 caps2 = cap_from_text("cap_setpcap+ep"); 36 ret = cap_set_proc(caps); 37 ret = cap_compare(caps, caps2); 38 printf("Caps were %sthe same\n", ret ? "not " : ""); 39 40 cap_free(caps); 41 cap_free(caps2); 42 return ret; 43 #else 44 printf("System doesn't support full POSIX capabilities.\n"); 45 return 1; 46 #endif 47 } 48