Commit b1ae15ab authored by Nick Kralevich's avatar Nick Kralevich
Browse files

Clean up code

Clean up the code, so it compiles with -Wall -Wextra -Werror

Change-Id: I78ad5941a45208e1a82181cedb5853753f58ff0d
parent 9ca4088e
......@@ -335,9 +335,7 @@ static int seapp_context_lookup(enum seapp_kind kind,
context_t ctx)
{
const char *username = NULL;
char *end = NULL;
struct passwd *pw;
struct seapp_context *cur;
struct seapp_context *cur = NULL;
int i;
size_t n;
uid_t userid;
......
......@@ -232,55 +232,6 @@ int security_commit_booleans(void)
hidden_def(security_commit_booleans)
static char *strtrim(char *dest, char *source, int size)
{
int i = 0;
char *ptr = source;
i = 0;
while (isspace(*ptr) && i < size) {
ptr++;
i++;
}
strncpy(dest, ptr, size);
for (i = strlen(dest) - 1; i > 0; i--) {
if (!isspace(dest[i]))
break;
}
dest[i + 1] = '\0';
return dest;
}
static int process_boolean(char *buffer, char *name, int namesize, int *val)
{
char name1[BUFSIZ];
char *ptr;
char *tok = strtok_r(buffer, "=", &ptr);
if (tok) {
strncpy(name1, tok, BUFSIZ - 1);
strtrim(name, name1, namesize - 1);
if (name[0] == '#')
return 0;
tok = strtok_r(NULL, "\0", &ptr);
if (tok) {
while (isspace(*tok))
tok++;
*val = -1;
if (isdigit(tok[0]))
*val = atoi(tok);
else if (!strncasecmp(tok, "true", sizeof("true") - 1))
*val = 1;
else if (!strncasecmp
(tok, "false", sizeof("false") - 1))
*val = 0;
if (*val != 0 && *val != 1) {
errno = EINVAL;
return -1;
}
}
}
return 1;
}
static void rollback(SELboolean * boollist, int end)
{
int i;
......
......@@ -13,7 +13,6 @@ int is_selinux_enabled(void)
char buf[BUFSIZ];
FILE *fp;
char *bufp;
size_t len;
int enabled = 0;
security_context_t con;
......
......@@ -95,7 +95,7 @@ out:
}
static struct selabel_lookup_rec *
selabel_lookup_common(struct selabel_handle *rec, int translating,
selabel_lookup_common(struct selabel_handle *rec,
const char *key, int type)
{
struct selabel_lookup_rec *lr;
......@@ -111,7 +111,7 @@ int selabel_lookup(struct selabel_handle *rec, security_context_t *con,
{
struct selabel_lookup_rec *lr;
lr = selabel_lookup_common(rec, 1, key, type);
lr = selabel_lookup_common(rec, key, type);
if (!lr)
return -1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment