|
|
b2d430 |
From e64aac5e33523f8473471b945403f0d9ba74c8cf Mon Sep 17 00:00:00 2001
|
|
|
b2d430 |
From: Lukas Slebodnik <lslebodn@redhat.com>
|
|
|
b2d430 |
Date: Fri, 8 Jul 2016 15:27:23 +0200
|
|
|
b2d430 |
Subject: [PATCH 08/18] sssctl: Fix warning maybe-uninitialized
|
|
|
b2d430 |
MIME-Version: 1.0
|
|
|
b2d430 |
Content-Type: text/plain; charset=UTF-8
|
|
|
b2d430 |
Content-Transfer-Encoding: 8bit
|
|
|
b2d430 |
|
|
|
b2d430 |
It looks like some special gcc optimalisation and special case
|
|
|
b2d430 |
may cause to have unitialized output argument _dom when return
|
|
|
b2d430 |
code is EOK
|
|
|
b2d430 |
|
|
|
b2d430 |
src/tools/sssctl/sssctl_cache.c: In function ‘sssctl_print_object’:
|
|
|
b2d430 |
src/tools/sssctl/sssctl_cache.c:491:8: error: ‘dom’ may be used
|
|
|
b2d430 |
uninitialized in this function [-Werror=maybe-uninitialized]
|
|
|
b2d430 |
if (dom == NULL) {
|
|
|
b2d430 |
^
|
|
|
b2d430 |
src/tools/sssctl/sssctl_cache.c:447:15: error: ‘entry’ may be used
|
|
|
b2d430 |
uninitialized in this function [-Werror=maybe-uninitialized]
|
|
|
b2d430 |
*_entry = talloc_steal(mem_ctx, entry);
|
|
|
b2d430 |
^~~~~~~~~~~~
|
|
|
b2d430 |
src/tools/sssctl/sssctl_cache.c:412:25: note: ‘entry’ was declared here
|
|
|
b2d430 |
struct sysdb_attrs *entry;
|
|
|
b2d430 |
^~~~~
|
|
|
b2d430 |
|
|
|
b2d430 |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
b2d430 |
(cherry picked from commit 64d664c201916d8678b5f4bd7e1559c7ece9217d)
|
|
|
b2d430 |
---
|
|
|
b2d430 |
src/tools/sssctl/sssctl_cache.c | 14 +++++++++-----
|
|
|
b2d430 |
1 file changed, 9 insertions(+), 5 deletions(-)
|
|
|
b2d430 |
|
|
|
b2d430 |
diff --git a/src/tools/sssctl/sssctl_cache.c b/src/tools/sssctl/sssctl_cache.c
|
|
|
b2d430 |
index 28de6c139d844f98f9b06844492c935696e19643..e23bb89db95217e66a441b7e4d6d32e668486cc8 100644
|
|
|
b2d430 |
--- a/src/tools/sssctl/sssctl_cache.c
|
|
|
b2d430 |
+++ b/src/tools/sssctl/sssctl_cache.c
|
|
|
b2d430 |
@@ -372,15 +372,19 @@ static errno_t sssctl_find_object(TALLOC_CTX *mem_ctx,
|
|
|
b2d430 |
|
|
|
b2d430 |
ret = sssctl_query_cache(tmp_ctx, dom->sysdb, base_dn, filter,
|
|
|
b2d430 |
attrs, &entry);
|
|
|
b2d430 |
- if (ret == EOK) {
|
|
|
b2d430 |
+ switch(ret) {
|
|
|
b2d430 |
+ case EOK:
|
|
|
b2d430 |
/* Entry was found. */
|
|
|
b2d430 |
*_entry = talloc_steal(mem_ctx, entry);
|
|
|
b2d430 |
*_dom = dom;
|
|
|
b2d430 |
goto done;
|
|
|
b2d430 |
- } else if (ret == ENOENT && fqn_provided) {
|
|
|
b2d430 |
- /* Not found but a domain was provided in input. We're done. */
|
|
|
b2d430 |
- goto done;
|
|
|
b2d430 |
- } else if (ret != ENOENT) {
|
|
|
b2d430 |
+ case ENOENT:
|
|
|
b2d430 |
+ if (fqn_provided) {
|
|
|
b2d430 |
+ /* Not found but a domain was provided in input. We're done. */
|
|
|
b2d430 |
+ goto done;
|
|
|
b2d430 |
+ }
|
|
|
b2d430 |
+ break;
|
|
|
b2d430 |
+ default:
|
|
|
b2d430 |
DEBUG(SSSDBG_CRIT_FAILURE, "Unable to query cache [%d]: %s\n",
|
|
|
b2d430 |
ret, sss_strerror(ret));
|
|
|
b2d430 |
goto done;
|
|
|
b2d430 |
--
|
|
|
b2d430 |
2.4.11
|
|
|
b2d430 |
|