aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--compat/src/main-test-old-cynara.c15
-rw-r--r--src/cyn-server.c8
-rw-r--r--src/expire.c2
-rw-r--r--src/filedb.c2
-rw-r--r--src/main-cynagorad.c14
-rw-r--r--src/main-cynagoradm.c9
-rw-r--r--src/socket.c6
8 files changed, 27 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aeb3a53..2995a07 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,7 +58,6 @@ link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined)
add_compile_options(-Wall -Wextra -Wconversion)
add_compile_options(-Wno-unused-parameter) # frankly not using a parameter does it care?
-add_compile_options(-Wno-sign-compare -Wno-sign-conversion)
add_compile_options(-Werror=maybe-uninitialized)
add_compile_options(-Werror=implicit-function-declaration)
add_compile_options(-ffunction-sections -fdata-sections)
diff --git a/compat/src/main-test-old-cynara.c b/compat/src/main-test-old-cynara.c
index ccc3baa..f5f58ba 100644
--- a/compat/src/main-test-old-cynara.c
+++ b/compat/src/main-test-old-cynara.c
@@ -43,7 +43,7 @@ struct cynara_async *aclient;
struct cynara_configuration *conf;
struct cynara *client;
char buffer[4000];
-int bufill;
+size_t bufill;
char *str[40];
int nstr;
int pollfd;
@@ -124,10 +124,10 @@ void adm_check(char *cli, char *usr, char *perm)
void adm_set()
{
struct cynara_admin_policy **policies, *p;
- int n, i;
+ unsigned n, i;
- n = (nstr - 2) / 4;
- policies = malloc((1 + n) * sizeof *policies + n * sizeof **policies);
+ n = (unsigned)((nstr - 2) / 4);
+ policies = malloc((1 + n) * (sizeof *policies) + n * sizeof **policies);
policies[n] = NULL;
p = (struct cynara_admin_policy*)(&policies[n + 1]);
for (i = 0 ; i < n ; i++, p++) {
@@ -275,12 +275,11 @@ int main(int ac, char **av)
if (ev.data.fd == 0) {
if (ev.events & EPOLLIN) {
- rc = (int)sizeof buffer - bufill;
- rc = (int)read(0, buffer, rc);
+ rc = (int)read(0, buffer, sizeof buffer - bufill);
if (rc == 0)
break;
if (rc > 0) {
- bufill += rc;
+ bufill += (size_t)rc;
while((p = memchr(buffer, '\n', bufill))) {
/* process one line */
*p++ = 0;
@@ -290,7 +289,7 @@ int main(int ac, char **av)
if (action())
goto terminate;
/* next line if any */
- bufill -= (int)(p - buffer);
+ bufill -= (size_t)(p - buffer);
if (!bufill)
break;
memmove(buffer, p, bufill);
diff --git a/src/cyn-server.c b/src/cyn-server.c
index d751fda..78143a4 100644
--- a/src/cyn-server.c
+++ b/src/cyn-server.c
@@ -120,13 +120,13 @@ void
dolog(
client_t *cli,
int c2s,
- int count,
+ unsigned count,
const char *fields[]
) {
static const char types[3][6] = { "check", "agent", "admin" };
static const char dir[2] = { '>', '<' };
- int i;
+ unsigned i;
fprintf(stderr, "%p%c%c%s", cli, dir[!c2s], dir[!c2s], types[cli->type]);
for (i = 0 ; i < count ; i++)
@@ -354,7 +354,7 @@ static
void
onrequest(
client_t *cli,
- int count,
+ unsigned count,
const char *args[]
) {
bool nextlog;
@@ -565,7 +565,7 @@ on_client_event(
goto terminate;
nargs = prot_get(cli->prot, &args);
while (nargs >= 0) {
- onrequest(cli, nargs, args);
+ onrequest(cli, (unsigned)nargs, args);
if (cli->invalid && !cli->relax)
goto terminate;
prot_next(cli->prot);
diff --git a/src/expire.c b/src/expire.c
index cfa5dff..23ce6ae 100644
--- a/src/expire.c
+++ b/src/expire.c
@@ -76,7 +76,7 @@ size_t exp2txt(time_t expire, char *buffer, size_t buflen)
n = 0;
#define ADD(C,U) \
if (expire >= U) { \
- n += snprintf(&b[n], sizeof b - n, "%lld" #C, (long long)(expire / U)); \
+ n += snprintf(&b[n], sizeof b - (size_t)n, "%lld" #C, (long long)(expire / U)); \
expire %= U; \
}
ADD(y,YEAR)
diff --git a/src/filedb.c b/src/filedb.c
index 86c302d..1fa5087 100644
--- a/src/filedb.c
+++ b/src/filedb.c
@@ -95,7 +95,7 @@ static const char uuid_names_v1[] = "b2c33494-995f-5cc2-9e5e-72ad412936a9\n--\n"
static const char uuid_rules_v1[] = "73630c61-89a9-5e82-8b07-5e53eee785c8\n--\n";
/** length of the identifications */
-static const int uuidlen = 40;
+static const uint32_t uuidlen = 40;
struct filedb
diff --git a/src/main-cynagorad.c b/src/main-cynagorad.c
index 66b5ea7..db5408d 100644
--- a/src/main-cynagorad.c
+++ b/src/main-cynagorad.c
@@ -276,8 +276,8 @@ int main(int ac, char **av)
fprintf(stderr, "can not find user '%s'\n", user);
return -1;
}
- uid = pw->pw_uid;
- gid = pw->pw_gid;
+ uid = (int)pw->pw_uid;
+ gid = (int)pw->pw_gid;
}
}
if (group) {
@@ -288,7 +288,7 @@ int main(int ac, char **av)
fprintf(stderr, "can not find group '%s'\n", group);
return -1;
}
- gid = gr->gr_gid;
+ gid = (int)gr->gr_gid;
}
}
@@ -300,14 +300,14 @@ int main(int ac, char **av)
/* drop privileges */
if (gid >= 0) {
- rc = setgid(gid);
+ rc = setgid((gid_t)gid);
if (rc < 0) {
fprintf(stderr, "can not change group: %m\n");
return -1;
}
}
if (uid >= 0) {
- rc = setuid(uid);
+ rc = setuid((uid_t)uid);
if (rc < 0) {
fprintf(stderr, "can not change user: %m\n");
return -1;
@@ -414,8 +414,8 @@ static void ensuredir(char *path, int length, int uid, int gid)
exit(1);
}
/* set ownership */
- if ((uid != st.st_uid && uid >= 0) || (gid != st.st_gid && gid >= 0)) {
- rc = chown(path, uid, gid);
+ if (((uid_t)uid != st.st_uid && uid >= 0) || ((gid_t)gid != st.st_gid && gid >= 0)) {
+ rc = chown(path, (uid_t)uid, (gid_t)gid);
if (rc < 0) {
fprintf(stderr, "can not own directory %s for uid=%d & gid=%d: %m\n", path, uid, gid);
exit(1);
diff --git a/src/main-cynagoradm.c b/src/main-cynagoradm.c
index 7b657c0..b668abb 100644
--- a/src/main-cynagoradm.c
+++ b/src/main-cynagoradm.c
@@ -303,7 +303,7 @@ help_expiration_text[] =
static cynagora_t *cynagora;
static char buffer[4000];
-static int bufill;
+static size_t bufill;
static char *str[40];
static int nstr;
static int pending;
@@ -789,12 +789,11 @@ int main(int ac, char **av)
for(;;) {
rc = poll(fds, 2, -1);
if (fds[0].revents & POLLIN) {
- rc = (int)sizeof buffer - bufill;
- rc = (int)read(0, buffer, rc);
+ rc = (int)read(0, buffer, sizeof buffer - bufill);
if (rc == 0)
break;
if (rc > 0) {
- bufill += rc;
+ bufill += (size_t)rc;
while((p = memchr(buffer, '\n', bufill))) {
/* process one line */
*p++ = 0;
@@ -802,7 +801,7 @@ int main(int ac, char **av)
while(str[nstr])
str[++nstr] = strtok(NULL, " \t");
do_all(nstr, str);
- bufill -= (int)(p - buffer);
+ bufill -= (size_t)(p - buffer);
if (!bufill)
break;
memmove(buffer, p, bufill);
diff --git a/src/socket.c b/src/socket.c
index bd6b804..fde9648 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -168,8 +168,8 @@ static int open_tcp(const char *spec, int server)
errno = EINVAL;
return -1;
}
- host = strndupa(spec, service++ - spec);
- service = strndupa(service, tail - service);
+ host = strndupa(spec, (size_t)(service++ - spec));
+ service = strndupa(service, (size_t)(tail - service));
/* get addr */
memset(&hint, 0, sizeof hint);
@@ -256,7 +256,7 @@ static struct entry *get_entry(const char *uri, int *offset)
}
i--;
l = (int)strlen(entries[i].prefix);
- if (!strncmp(uri, entries[i].prefix, l))
+ if (!strncmp(uri, entries[i].prefix, (size_t)l))
break;
}