From f26e010bba003fb88d1b9fce0b6bb79eeee54582 Mon Sep 17 00:00:00 2001 From: Petr Baudis <pasky@ucw.cz> Date: Fri, 16 Mar 2012 01:12:20 +0100 Subject: [PATCH] Enable more warnings and fix few sign-related situations --- Makefile | 2 +- compctl.c | 2 +- compctld.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d37f242..1e1fe1c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CFLAGS=-Wall -O3 -std=gnu99 -ggdb3 +CFLAGS=-Wall -Wextra -Wno-unused -O3 -std=gnu99 -ggdb3 all: compctld compctl diff --git a/compctl.c b/compctl.c index fff81ab..52b3bfa 100644 --- a/compctl.c +++ b/compctl.c @@ -54,7 +54,7 @@ daemon_chat(char *cmd) perror("sendmsg"); exit(EXIT_FAILURE); } - if (sent < msg.msg_iov->iov_len) { + if ((size_t) sent < msg.msg_iov->iov_len) { fprintf(stderr, "incomplete send %zd < %zu, FIXME\n", sent, msg.msg_iov->iov_len); exit(EXIT_FAILURE); } diff --git a/compctld.c b/compctld.c index 6ac733f..5824172 100644 --- a/compctld.c +++ b/compctld.c @@ -47,8 +47,8 @@ memory_limits(size_t *minuser, size_t *mincomp, size_t *maxcomp, size_t *total) *minuser = static_maxfree; *mincomp = static_minfree; - *maxcomp = *total - *minuser; - if (*maxcomp < 0) *maxcomp = 0; + ssize_t smaxcomp = *total - *minuser; + *maxcomp = smaxcomp > 0 ? smaxcomp : 0; /* maxcomp < mincomp may happen; they are used in different * settings. */ } @@ -101,7 +101,7 @@ mprintf(int fd, char *fmt, ...) logperror("sendmsg"); return; } - if (sent < iov.iov_len) { + if ((size_t) sent < iov.iov_len) { syslog(LOG_INFO, "incomplete send %zd < %zu, FIXME", sent, iov.iov_len); return; } -- GitLab