From 90a18110e9c014ff33977be4656886b093c7e022 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 24 Nov 2004 01:03:23 +0000 Subject: r3931: Fix all "may be used uninitialized" and "shadow" warnings. Jeremy. (This used to be commit 8e979772a640bb4f00f4d72b6a9c837b8ef14333) --- source3/client/client.c | 6 ++++-- source3/libsmb/libsmbclient.c | 8 ++++---- source3/nsswitch/winbindd_wins.c | 6 ++++-- source3/passdb/pdb_sql.c | 3 +++ source3/utils/status.c | 8 ++++---- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 29635e4de9..8c43f4e16e 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -2816,10 +2816,12 @@ static char **completion_fn(const char *text, int start, int end) return NULL; } else { char **matches; - int i, len, samelen, count=1; + int i, len, samelen = 0, count=1; matches = (char **)malloc(sizeof(matches[0])*MAX_COMPLETIONS); - if (!matches) return NULL; + if (!matches) { + return NULL; + } matches[0] = NULL; len = strlen(text); diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index 2b0115eaaa..3dec0c92b4 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -1697,7 +1697,7 @@ list_unique_wg_fn(const char *name, uint32 type, const char *comment, void *stat struct smbc_dir_list *dir_list; struct smbc_dirent *dirent; int dirent_type; - int remove = 0; + int do_remove = 0; dirent_type = dir->dir_type; @@ -1714,13 +1714,13 @@ list_unique_wg_fn(const char *name, uint32 type, const char *comment, void *stat for (dir_list = dir->dir_list; dir_list != dir->dir_end; dir_list = dir_list->next) { - if (! remove && + if (! do_remove && strcmp(dir_list->dirent->name, dirent->name) == 0) { /* Duplicate. End end of list need to be removed. */ - remove = 1; + do_remove = 1; } - if (remove && dir_list->next == dir->dir_end) { + if (do_remove && dir_list->next == dir->dir_end) { /* Found the end of the list. Remove it. */ dir->dir_end = dir_list; free(dir_list->next); diff --git a/source3/nsswitch/winbindd_wins.c b/source3/nsswitch/winbindd_wins.c index 6b37e5bcf4..107c9d264c 100644 --- a/source3/nsswitch/winbindd_wins.c +++ b/source3/nsswitch/winbindd_wins.c @@ -88,7 +88,7 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count) { int fd; struct ip_service *ret = NULL; - struct in_addr *return_ip; + struct in_addr *return_ip = NULL; int j, i, flags = 0; *count = 0; @@ -121,7 +121,9 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count) j--) { struct in_addr *bcast = iface_n_bcast(j); return_ip = name_query(fd,name,0x20,True,True,*bcast,count, &flags, NULL); - if (return_ip) break; + if (return_ip) { + break; + } } close(fd); diff --git a/source3/passdb/pdb_sql.c b/source3/passdb/pdb_sql.c index ffb8313a97..37e408a387 100644 --- a/source3/passdb/pdb_sql.c +++ b/source3/passdb/pdb_sql.c @@ -201,6 +201,9 @@ char *sql_account_query_select(const char *data, BOOL update, enum sql_search_fi field_string = config_value_read(data, "username column", CONFIG_USERNAME_DEFAULT); break; + default: + field_string = "unknown"; + break; } asprintf(&query, diff --git a/source3/utils/status.c b/source3/utils/status.c index 122c6193f9..73cf2a2e29 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -50,20 +50,20 @@ static int show_brl; const char *username = NULL; /* added by OH */ -static void Ucrit_addUsername(const char *username) +static void Ucrit_addUsername(const char *user_name) { - pstrcpy(Ucrit_username, username); + pstrcpy(Ucrit_username, user_name); if ( strlen(Ucrit_username) > 0 ) Ucrit_IsActive = 1; } -static unsigned int Ucrit_checkUsername(const char *username) +static unsigned int Ucrit_checkUsername(const char *user_name) { if ( !Ucrit_IsActive ) return 1; - if ( strcmp(Ucrit_username,username) == 0 ) + if ( strcmp(Ucrit_username,user_name) == 0 ) return 1; return 0; -- cgit