aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Barnes <craigbarnes@protonmail.com>2020-08-25 18:39:17 +0000
committerCraig Barnes <craigbarnes@protonmail.com>2020-08-25 18:39:17 +0000
commitf3acfea81565edf38ca7546fe4a351126d04442a (patch)
treeff35ea47189229023254eca733b1a93d385e0953
parentMerge branch 'pedantic' into master (diff)
fix some buggy comparisons relating to signed/unsigned types
-rw-r--r--config.c2
-rw-r--r--shm.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/config.c b/config.c
index a850b617..8a7a3476 100644
--- a/config.c
+++ b/config.c
@@ -427,7 +427,7 @@ parse_section_scrollback(const char *key, const char *value, struct config *conf
conf->scrollback.indicator.text = NULL;
size_t len = mbstowcs(NULL, value, 0);
- if (len < 0) {
+ if (len == (size_t)-1) {
LOG_AND_NOTIFY_ERRNO(
"%s:%d: [scrollback]: indicator-format: "
"invalid value: %s", path, lineno, value);
diff --git a/shm.c b/shm.c
index 2b2c3435..8a0a136d 100644
--- a/shm.c
+++ b/shm.c
@@ -131,10 +131,12 @@ page_size(void)
{
static size_t size = 0;
if (size == 0) {
- size = sysconf(_SC_PAGE_SIZE);
- if (size < 0) {
+ long n = sysconf(_SC_PAGE_SIZE);
+ if (n <= 0) {
LOG_ERRNO("failed to get page size");
size = 4096;
+ } else {
+ size = (size_t)n;
}
}
assert(size > 0);