checkpolicy: fix most gcc -Wwrite-strings warnings

Acked-by: Steve Lawrence <slawrence@tresys.com>
This commit is contained in:
Nicolas Iooss 2014-09-14 23:41:46 +02:00 committed by Steve Lawrence
parent b8b0d7fa8a
commit 7dcb7a5946
6 changed files with 16 additions and 15 deletions

View File

@ -41,13 +41,13 @@ static sidtab_t sidtab;
extern int mlspol;
static int handle_unknown = SEPOL_DENY_UNKNOWN;
static char *txtfile = "policy.conf";
static char *binfile = "policy";
static const char *txtfile = "policy.conf";
static const char *binfile = "policy";
unsigned int policy_type = POLICY_BASE;
unsigned int policyvers = MOD_POLICYDB_VERSION_MAX;
static int read_binary_policy(policydb_t * p, char *file, char *progname)
static int read_binary_policy(policydb_t * p, const char *file, const char *progname)
{
int fd;
struct stat sb;
@ -108,7 +108,7 @@ static int read_binary_policy(policydb_t * p, char *file, char *progname)
return 0;
}
static int write_binary_policy(policydb_t * p, char *file, char *progname)
static int write_binary_policy(policydb_t * p, const char *file, char *progname)
{
FILE *outfp = NULL;
struct policy_file pf;
@ -161,7 +161,7 @@ static void usage(char *progname)
int main(int argc, char **argv)
{
char *file = txtfile, *outfile = NULL;
const char *file = txtfile, *outfile = NULL;
unsigned int binary = 0;
int ch;
int show_version = 0;

View File

@ -96,8 +96,8 @@ extern policydb_t *policydbp;
extern int mlspol;
static int handle_unknown = SEPOL_DENY_UNKNOWN;
static char *txtfile = "policy.conf";
static char *binfile = "policy";
static const char *txtfile = "policy.conf";
static const char *binfile = "policy";
unsigned int policyvers = POLICYDB_VERSION_MAX;
@ -381,7 +381,8 @@ int main(int argc, char **argv)
sepol_security_context_t scontext;
struct sepol_av_decision avd;
class_datum_t *cladatum;
char ans[80 + 1], *file = txtfile, *outfile = NULL, *path, *fstype;
const char *file = txtfile;
char ans[80 + 1], *outfile = NULL, *path, *fstype;
size_t scontext_len, pathlen;
unsigned int i;
unsigned int protocol, port;

View File

@ -107,7 +107,7 @@ int insert_separator(int push)
return 0;
}
int insert_id(char *id, int push)
int insert_id(const char *id, int push)
{
char *newid = 0;
int error;

View File

@ -64,7 +64,7 @@ int define_typebounds(void);
int define_type(int alias);
int define_user(void);
int define_validatetrans(constraint_expr_t *expr);
int insert_id(char *id,int push);
int insert_id(const char *id,int push);
int insert_separator(int push);
role_datum_t *define_role_dom(role_datum_t *r);
role_datum_t *merge_roles_dom(role_datum_t *r1,role_datum_t *r2);

View File

@ -65,7 +65,7 @@ static const char *symbol_labels[9] = {
"levels ", "cats ", "attribs"
};
void usage(char *progname)
void usage(const char *progname)
{
printf("usage: %s binary_pol_file\n\n", progname);
exit(1);
@ -99,7 +99,7 @@ static void render_access_bitmap(ebitmap_t * map, uint32_t class,
}
static void display_id(policydb_t * p, FILE * fp, uint32_t symbol_type,
uint32_t symbol_value, char *prefix)
uint32_t symbol_value, const char *prefix)
{
char *id = p->sym_val_to_name[symbol_type][symbol_value];
scope_datum_t *scope =

View File

@ -37,7 +37,7 @@
static policydb_t policydb;
void usage(char *progname)
void usage(const char *progname)
{
printf("usage: %s binary_pol_file\n\n", progname);
exit(1);
@ -320,9 +320,9 @@ static void display_policycaps(policydb_t * p, FILE * fp)
}
static void display_id(policydb_t *p, FILE *fp, uint32_t symbol_type,
uint32_t symbol_value, char *prefix)
uint32_t symbol_value, const char *prefix)
{
char *id = p->sym_val_to_name[symbol_type][symbol_value];
const char *id = p->sym_val_to_name[symbol_type][symbol_value];
fprintf(fp, " %s%s", prefix, id);
}