/* getcap.c
*
- * Copyright (C) 2006 Simone Piccardi
+ * Copyright (C) 2006-2012 Simone Piccardi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <stdio.h> /* standard I/O library */
#include <string.h> /* C strings library */
#include <sys/types.h> /* primitive system data types */
-#include <sys/capability.h>
+#include <sys/capability.h> /* need package libcap-dev */
/* Help printing routine */
void usage(void);
*/
int i;
pid_t pid = 0;
- cap_t capab = NULL;
+ cap_t capab;
char *string;
int res;
return 1;
}
} else {
- capab = cap_init();
- res = capgetp(pid, capab);
- if (res) {
+ capab = cap_get_pid(pid);
+ if (capab == NULL) {
perror("cannot get process capabilities");
return 1;
}