mirror of https://github.com/rd235/cado
printf warnings.
This commit is contained in:
parent
6aaa8cee2f
commit
5b14b97afe
3
cado.c
3
cado.c
|
@ -30,6 +30,7 @@
|
||||||
#include <capset_from_namelist.h>
|
#include <capset_from_namelist.h>
|
||||||
#include <read_conf.h>
|
#include <read_conf.h>
|
||||||
#include <set_ambient_cap.h>
|
#include <set_ambient_cap.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
static void printcapset(uint64_t capset, char *indent) {
|
static void printcapset(uint64_t capset, char *indent) {
|
||||||
cap_value_t cap;
|
cap_value_t cap;
|
||||||
|
@ -41,7 +42,7 @@ static void printcapset(uint64_t capset, char *indent) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count > 1)
|
if (count > 1)
|
||||||
printf("%s %016llx\n",indent,capset);
|
printf("%s %016" PRIx64 "\n",indent,capset);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define OPTSTRING "hqvs"
|
#define OPTSTRING "hqvs"
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include <sys/capability.h>
|
#include <sys/capability.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
char *tag="CapAmb:\t";
|
char *tag="CapAmb:\t";
|
||||||
uint64_t get_capamb(pid_t pid) {
|
uint64_t get_capamb(pid_t pid) {
|
||||||
|
@ -46,7 +47,9 @@ uint64_t get_capamb(pid_t pid) {
|
||||||
if (c == tag[status]) {
|
if (c == tag[status]) {
|
||||||
status++;
|
status++;
|
||||||
if (status == target) {
|
if (status == target) {
|
||||||
fscanf(f,"%llx",&capamb);
|
int fields = 0;
|
||||||
|
if ((fields = fscanf(f,"%" PRIx64 "",&capamb)) != 1)
|
||||||
|
fprintf(stderr, "WARNING: fscanf on %s return %d fields.\n", filename, fields);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -126,6 +129,8 @@ int main(int argc, char *argv[]) {
|
||||||
if (prompt) printf("#");
|
if (prompt) printf("#");
|
||||||
if (compact) printf("\n");
|
if (compact) printf("\n");
|
||||||
if (longlist && count > 1)
|
if (longlist && count > 1)
|
||||||
printf(" %016llx\n",capamb);
|
printf(" %016" PRIx64 "\n",capamb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ static int addcap(char *name, uint64_t *capset) {
|
||||||
int capset_from_namelist(char *namelist, uint64_t *capset) {
|
int capset_from_namelist(char *namelist, uint64_t *capset) {
|
||||||
int rv=0;
|
int rv=0;
|
||||||
char *onecap;
|
char *onecap;
|
||||||
char *tmptok;
|
char *tmptok = NULL;
|
||||||
for (; (onecap=strtok_r(namelist,",",&tmptok)) != NULL; namelist=NULL)
|
for (; (onecap=strtok_r(namelist,",",&tmptok)) != NULL; namelist=NULL)
|
||||||
rv |= addcap(onecap,capset);
|
rv |= addcap(onecap,capset);
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -51,7 +51,8 @@ uint64_t get_authorized_caps(char **user_groups) {
|
||||||
f=fopen(CADO_CONF, "r");
|
f=fopen(CADO_CONF, "r");
|
||||||
if (f) {
|
if (f) {
|
||||||
char *line=NULL;
|
char *line=NULL;
|
||||||
ssize_t len,n=0;
|
size_t n = 0;
|
||||||
|
ssize_t len = 0;
|
||||||
while ((len=getline(&line, &n, f)) > 0) {
|
while ((len=getline(&line, &n, f)) > 0) {
|
||||||
//printf("%s",line);
|
//printf("%s",line);
|
||||||
char *scan=line;
|
char *scan=line;
|
||||||
|
|
Loading…
Reference in New Issue