libsemanage: initialize bools_modified variable.

In semanage_direct_commit() error path, bools_modified can be used in a
if statement without being initialized (when a "goto cleanup" is taken
early).  clang warns about this bug:

    direct_api.c:1441:18: error: variable 'bools_modified' may be
    uninitialized when used here [-Werror,-Wconditional-uninitialized]
            if (modified || bools_modified) {
                            ^~~~~~~~~~~~~~
    direct_api.c:1087:48: note: initialize the variable 'bools_modified'
    to silence this warning
                preserve_tunables_modified, bools_modified,
                                                          ^
                                                           = 0

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
Nicolas Iooss 2016-01-31 11:36:37 +01:00 committed by Steve Lawrence
parent 1bfb1a4ffd
commit a11ce9dae5

View file

@ -1076,7 +1076,7 @@ static int semanage_direct_commit(semanage_handle_t * sh)
/* Declare some variables */ /* Declare some variables */
int modified = 0, fcontexts_modified, ports_modified, int modified = 0, fcontexts_modified, ports_modified,
seusers_modified, users_extra_modified, dontaudit_modified, seusers_modified, users_extra_modified, dontaudit_modified,
preserve_tunables_modified, bools_modified, preserve_tunables_modified, bools_modified = 0,
disable_dontaudit, preserve_tunables; disable_dontaudit, preserve_tunables;
dbase_config_t *users = semanage_user_dbase_local(sh); dbase_config_t *users = semanage_user_dbase_local(sh);
dbase_config_t *users_base = semanage_user_base_dbase_local(sh); dbase_config_t *users_base = semanage_user_base_dbase_local(sh);