summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2016-07-08 15:27:23 +0200
committerJakub Hrozek <jhrozek@redhat.com>2016-07-12 11:57:57 +0200
commit64d664c201916d8678b5f4bd7e1559c7ece9217d (patch)
tree7f9c16ec1bd2ebd8467dfeecb545b5d8e7857cc4
parentf3db22862d22821be2d566435cb0c59387343fc2 (diff)
downloadsssd-64d664c201916d8678b5f4bd7e1559c7ece9217d.zip
sssd-64d664c201916d8678b5f4bd7e1559c7ece9217d.tar.gz
sssd-64d664c201916d8678b5f4bd7e1559c7ece9217d.tar.xz
sssctl: Fix warning maybe-uninitialized
It looks like some special gcc optimalisation and special case may cause to have unitialized output argument _dom when return code is EOK src/tools/sssctl/sssctl_cache.c: In function ‘sssctl_print_object’: src/tools/sssctl/sssctl_cache.c:491:8: error: ‘dom’ may be used uninitialized in this function [-Werror=maybe-uninitialized] if (dom == NULL) { ^ src/tools/sssctl/sssctl_cache.c:447:15: error: ‘entry’ may be used uninitialized in this function [-Werror=maybe-uninitialized] *_entry = talloc_steal(mem_ctx, entry); ^~~~~~~~~~~~ src/tools/sssctl/sssctl_cache.c:412:25: note: ‘entry’ was declared here struct sysdb_attrs *entry; ^~~~~ Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
-rw-r--r--src/tools/sssctl/sssctl_cache.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/tools/sssctl/sssctl_cache.c b/src/tools/sssctl/sssctl_cache.c
index 28de6c1..e23bb89 100644
--- a/src/tools/sssctl/sssctl_cache.c
+++ b/src/tools/sssctl/sssctl_cache.c
@@ -372,15 +372,19 @@ static errno_t sssctl_find_object(TALLOC_CTX *mem_ctx,
ret = sssctl_query_cache(tmp_ctx, dom->sysdb, base_dn, filter,
attrs, &entry);
- if (ret == EOK) {
+ switch(ret) {
+ case EOK:
/* Entry was found. */
*_entry = talloc_steal(mem_ctx, entry);
*_dom = dom;
goto done;
- } else if (ret == ENOENT && fqn_provided) {
- /* Not found but a domain was provided in input. We're done. */
- goto done;
- } else if (ret != ENOENT) {
+ case ENOENT:
+ if (fqn_provided) {
+ /* Not found but a domain was provided in input. We're done. */
+ goto done;
+ }
+ break;
+ default:
DEBUG(SSSDBG_CRIT_FAILURE, "Unable to query cache [%d]: %s\n",
ret, sss_strerror(ret));
goto done;