mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
ctdb-common: Fix signed/unsigned comparisons by casting
One case needs an extra variable declared. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
79a7cc3fb9
commit
0ab5d5cece
@ -111,7 +111,10 @@ bool ctdb_set_helper(const char *type, char *helper, size_t size,
|
||||
("Unable to set %s - dir is NULL\n", type));
|
||||
return false;
|
||||
} else {
|
||||
if (snprintf(helper, size, "%s/%s", dir, file) >= size) {
|
||||
int ret;
|
||||
|
||||
ret = snprintf(helper, size, "%s/%s", dir, file);
|
||||
if (ret < 0 || (size_t)ret >= size) {
|
||||
DEBUG(DEBUG_ERR,
|
||||
("Unable to set %s - path too long\n", type));
|
||||
return false;
|
||||
|
@ -159,7 +159,7 @@ int event_script_chmod(const char *script_dir,
|
||||
script_file = script_name;
|
||||
} else {
|
||||
ret = snprintf(buf, sizeof(buf), "%s.script", script_name);
|
||||
if (ret >= sizeof(buf)) {
|
||||
if (ret < 0 || (size_t)ret >= sizeof(buf)) {
|
||||
return ENAMETOOLONG;
|
||||
}
|
||||
script_file = buf;
|
||||
@ -196,7 +196,7 @@ int event_script_chmod(const char *script_dir,
|
||||
"%s/%s",
|
||||
script_dir,
|
||||
script_file);
|
||||
if (ret >= sizeof(filename)) {
|
||||
if (ret < 0 || (size_t)ret >= sizeof(filename)) {
|
||||
return ENAMETOOLONG;
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ static void sock_queue_handler(struct tevent_context *ev,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (num_ready > queue->buflen - queue->end) {
|
||||
if ((size_t)num_ready > queue->buflen - queue->end) {
|
||||
queue->buf = talloc_realloc_size(queue, queue->buf,
|
||||
queue->end + num_ready);
|
||||
if (queue->buf == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user