1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

ctdb-recovery: Fix signed/unsigned comparisons by declaring as unsigned

Simple cases where variables need to be declared as an unsigned type
instead of an int.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2019-05-23 08:43:58 +10:00 committed by Amitay Isaacs
parent 7fa6c1206a
commit fa7bd35b6a
2 changed files with 31 additions and 21 deletions

View File

@ -144,7 +144,7 @@ ctdb_control_getnodemap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA ind
int
ctdb_control_reload_nodes_file(struct ctdb_context *ctdb, uint32_t opcode)
{
int i, num_nodes;
unsigned int i, num_nodes;
TALLOC_CTX *tmp_ctx;
struct ctdb_node **nodes;
@ -453,7 +453,8 @@ int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata)
{
struct ctdb_marshall_buffer *reply = (struct ctdb_marshall_buffer *)indata.dptr;
struct ctdb_db_context *ctdb_db;
int i, ret;
unsigned int i;
int ret;
struct ctdb_rec_data_old *rec;
if (indata.dsize < offsetof(struct ctdb_marshall_buffer, data)) {
@ -554,7 +555,8 @@ static void db_push_msg_handler(uint64_t srvid, TDB_DATA indata,
private_data, struct db_push_state);
struct ctdb_marshall_buffer *recs;
struct ctdb_rec_data_old *rec;
int i, ret;
unsigned int i;
int ret;
if (state->failed) {
return;
@ -1255,7 +1257,7 @@ int32_t ctdb_control_try_delete_records(struct ctdb_context *ctdb, TDB_DATA inda
{
struct ctdb_marshall_buffer *reply = (struct ctdb_marshall_buffer *)indata.dptr;
struct ctdb_db_context *ctdb_db;
int i;
unsigned int i;
struct ctdb_rec_data_old *rec;
struct ctdb_marshall_buffer *records;

View File

@ -430,7 +430,8 @@ static int set_recovery_mode(struct ctdb_context *ctdb,
static int create_missing_remote_databases(struct ctdb_context *ctdb, struct ctdb_node_map_old *nodemap,
uint32_t pnn, struct ctdb_dbid_map_old *dbmap, TALLOC_CTX *mem_ctx)
{
int i, j, db, ret;
unsigned int i, j, db;
int ret;
struct ctdb_dbid_map_old *remote_dbmap;
/* verify that all other nodes have all our databases */
@ -494,7 +495,8 @@ static int create_missing_remote_databases(struct ctdb_context *ctdb, struct ctd
static int create_missing_local_databases(struct ctdb_context *ctdb, struct ctdb_node_map_old *nodemap,
uint32_t pnn, struct ctdb_dbid_map_old **dbmap, TALLOC_CTX *mem_ctx)
{
int i, j, db, ret;
unsigned int i, j, db;
int ret;
struct ctdb_dbid_map_old *remote_dbmap;
/* verify that we have all database any other node has */
@ -654,7 +656,8 @@ static void vacuum_fetch_handler(uint64_t srvid, TDB_DATA data,
private_data, struct ctdb_recoverd);
struct ctdb_context *ctdb = rec->ctdb;
struct ctdb_marshall_buffer *recs;
int ret, i;
unsigned int i;
int ret;
TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
const char *name;
struct ctdb_dbid_map_old *dbmap=NULL;
@ -805,7 +808,7 @@ static void ctdb_wait_election(struct ctdb_recoverd *rec)
*/
static int update_local_flags(struct ctdb_recoverd *rec, struct ctdb_node_map_old *nodemap)
{
int j;
unsigned int j;
struct ctdb_context *ctdb = rec->ctdb;
TALLOC_CTX *mem_ctx = talloc_new(ctdb);
@ -1027,7 +1030,7 @@ static void ctdb_recovery_unlock(struct ctdb_recoverd *rec)
static void ban_misbehaving_nodes(struct ctdb_recoverd *rec, bool *self_ban)
{
struct ctdb_context *ctdb = rec->ctdb;
int i;
unsigned int i;
struct ctdb_banning_state *ban_state;
*self_ban = false;
@ -1184,7 +1187,8 @@ static int ctdb_takeover(struct ctdb_recoverd *rec,
{
static char prog[PATH_MAX+1] = "";
char *arg;
int i, ret;
unsigned int i;
int ret;
if (!ctdb_set_helper("takeover_helper", prog, sizeof(prog),
"CTDB_TAKEOVER_HELPER", CTDB_HELPER_BINDIR,
@ -1223,7 +1227,7 @@ static bool do_takeover_run(struct ctdb_recoverd *rec,
uint32_t *nodes = NULL;
struct ctdb_disable_message dtr;
TDB_DATA data;
int i;
size_t i;
uint32_t *rebalance_nodes = rec->force_rebalance_nodes;
int ret;
bool ok;
@ -1335,7 +1339,8 @@ static int do_recovery(struct ctdb_recoverd *rec,
struct ctdb_node_map_old *nodemap, struct ctdb_vnn_map *vnnmap)
{
struct ctdb_context *ctdb = rec->ctdb;
int i, ret;
unsigned int i;
int ret;
struct ctdb_dbid_map_old *dbmap;
bool self_ban;
@ -1542,7 +1547,8 @@ struct election_message {
*/
static void ctdb_election_data(struct ctdb_recoverd *rec, struct election_message *em)
{
int ret, i;
unsigned int i;
int ret;
struct ctdb_node_map_old *nodemap;
struct ctdb_context *ctdb = rec->ctdb;
@ -2049,7 +2055,7 @@ static void monitor_handler(uint64_t srvid, TDB_DATA data, void *private_data)
struct ctdb_node_flag_change *c = (struct ctdb_node_flag_change *)data.dptr;
struct ctdb_node_map_old *nodemap=NULL;
TALLOC_CTX *tmp_ctx;
int i;
unsigned int i;
if (data.dsize != sizeof(*c)) {
DEBUG(DEBUG_ERR,(__location__ "Invalid data in ctdb_node_flag_change\n"));
@ -2175,8 +2181,8 @@ static enum monitor_result verify_recmode(struct ctdb_context *ctdb, struct ctdb
TALLOC_CTX *mem_ctx = talloc_new(ctdb);
struct ctdb_client_control_state *state;
enum monitor_result status;
int j;
unsigned int j;
rmdata = talloc(mem_ctx, struct verify_recmode_normal_data);
CTDB_NO_MEMORY_FATAL(ctdb, rmdata);
rmdata->count = 0;
@ -2268,8 +2274,8 @@ static enum monitor_result verify_recmaster(struct ctdb_recoverd *rec, struct ct
TALLOC_CTX *mem_ctx = talloc_new(ctdb);
struct ctdb_client_control_state *state;
enum monitor_result status;
int j;
unsigned int j;
rmdata = talloc(mem_ctx, struct verify_recmaster_data);
CTDB_NO_MEMORY_FATAL(ctdb, rmdata);
rmdata->rec = rec;
@ -2351,7 +2357,7 @@ static bool interfaces_have_changed(struct ctdb_context *ctdb,
ret = true;
} else {
/* See if interface names or link states have changed */
int i;
unsigned int i;
for (i = 0; i < rec->ifaces->num; i++) {
struct ctdb_iface * iface = &rec->ifaces->ifaces[i];
if (strcmp(iface->name, ifaces->ifaces[i].name) != 0) {
@ -2387,7 +2393,8 @@ static int verify_local_ip_allocation(struct ctdb_context *ctdb,
struct ctdb_node_map_old *nodemap)
{
TALLOC_CTX *mem_ctx = talloc_new(NULL);
int ret, j;
unsigned int j;
int ret;
bool need_takeover_run = false;
struct ctdb_public_ip_list_old *ips = NULL;
@ -2638,7 +2645,8 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
struct ctdb_vnn_map *remote_vnnmap=NULL;
uint32_t num_lmasters;
int32_t debug_level;
int i, j, ret;
unsigned int i, j;
int ret;
bool self_ban;