summaryrefslogtreecommitdiff
path: root/ctdb/common
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2019-06-02 14:05:28 +1000
committerAmitay Isaacs <amitay@samba.org>2019-06-05 10:25:49 +0000
commit2b3150db944076f7dc4300bb73c766bf4d7517b1 (patch)
tree288fe6ec4645026e61ee7e04d0fde373479cc7c0 /ctdb/common
parent5b9456b70b611e5f520bb90b9e807f6ddfb64c98 (diff)
downloadsamba-2b3150db944076f7dc4300bb73c766bf4d7517b1.tar.gz
ctdb-common: Fix signed/unsigned comparisons by casting
In one case, given triviality of change, add missing braces and fix whitespace. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/common')
-rw-r--r--ctdb/common/logging.c14
-rw-r--r--ctdb/common/path.c2
2 files changed, 8 insertions, 8 deletions
diff --git a/ctdb/common/logging.c b/ctdb/common/logging.c
index fd763170304..a4321b68ba9 100644
--- a/ctdb/common/logging.c
+++ b/ctdb/common/logging.c
@@ -63,7 +63,7 @@ bool debug_level_parse(const char *log_string, int *log_level)
if (isdigit(log_string[0])) {
int level = atoi(log_string);
- if (level >= 0 && level < ARRAY_SIZE(log_string_map)) {
+ if (level >= 0 && (size_t)level < ARRAY_SIZE(log_string_map)) {
*log_level = level;
return true;
}
@@ -253,12 +253,12 @@ static int debug_level_to_priority(int level)
};
int priority;
- if( level >= ARRAY_SIZE(priority_map) || level < 0)
- priority = LOG_DEBUG;
- else
- priority = priority_map[level];
-
- return priority;
+ if ((size_t)level >= ARRAY_SIZE(priority_map) || level < 0) {
+ priority = LOG_DEBUG;
+ } else {
+ priority = priority_map[level];
+ }
+ return priority;
}
struct syslog_log_state {
diff --git a/ctdb/common/path.c b/ctdb/common/path.c
index 69e606b4ede..ea3b08f4b2e 100644
--- a/ctdb/common/path.c
+++ b/ctdb/common/path.c
@@ -89,7 +89,7 @@ static bool path_construct(char *path, const char *subdir)
subdir);
}
- if (len >= sizeof(p)) {
+ if ((size_t)len >= sizeof(p)) {
return false;
}