Hi,

some of the compiler flags used to build Fedora packages, e.g.
'-Wp,-D_FORTIFY_SOURCE=2' produces some extra warnings which were not
addressed so far. Except the ones for krb5_common.c in 0001 they are
cosmetics but might still irritate some people or tools.

bye,
Sumit
From e2349df11976339882ada658ce98c479adfcced0 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sb...@redhat.com>
Date: Fri, 24 Sep 2010 09:54:45 +0200
Subject: [PATCH 1/2] Suppress some 'may be used uninitialized' warnings

---
 src/providers/krb5/krb5_common.c |    4 +++-
 src/providers/ldap/sdap_access.c |    2 +-
 src/providers/proxy/proxy_auth.c |    2 +-
 src/tests/auth-tests.c           |    2 +-
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/providers/krb5/krb5_common.c b/src/providers/krb5/krb5_common.c
index e5471e3..74674d7 100644
--- a/src/providers/krb5/krb5_common.c
+++ b/src/providers/krb5/krb5_common.c
@@ -184,7 +184,8 @@ errno_t write_krb5info_file(const char *realm, const char 
*server,
             if (errno == EINTR || errno == EAGAIN) {
                 continue;
             }
-            DEBUG(1, ("write failed [%d][%s].\n", errno, strerror(errno)));
+            ret = errno;
+            DEBUG(1, ("write failed [%d][%s].\n", ret, strerror(ret)));
             goto done;
         }
         else {
@@ -195,6 +196,7 @@ errno_t write_krb5info_file(const char *realm, const char 
*server,
     if (written != server_len) {
         DEBUG(1, ("Write error, wrote [%d] bytes, expected [%d]\n",
                    written, server_len));
+        ret = EIO;
         goto done;
     }
 
diff --git a/src/providers/ldap/sdap_access.c b/src/providers/ldap/sdap_access.c
index 90b5371..4a30b74 100644
--- a/src/providers/ldap/sdap_access.c
+++ b/src/providers/ldap/sdap_access.c
@@ -452,7 +452,7 @@ static errno_t sdap_access_recv(struct tevent_req *req, int 
*pam_status)
 static void sdap_access_done(struct tevent_req *req)
 {
     errno_t ret;
-    int pam_status;
+    int pam_status = PAM_SYSTEM_ERR;
     struct be_req *breq =
             tevent_req_callback_data(req, struct be_req);
 
diff --git a/src/providers/proxy/proxy_auth.c b/src/providers/proxy/proxy_auth.c
index a78de31..64b38cb 100644
--- a/src/providers/proxy/proxy_auth.c
+++ b/src/providers/proxy/proxy_auth.c
@@ -711,7 +711,7 @@ static void proxy_child_done(struct tevent_req *req)
 {
     struct proxy_client_ctx *client_ctx =
             tevent_req_callback_data(req, struct proxy_client_ctx);
-    struct pam_data *pd;
+    struct pam_data *pd = NULL;
     char *password;
     int ret;
     struct tevent_immediate *imm;
diff --git a/src/tests/auth-tests.c b/src/tests/auth-tests.c
index a3de43c..bae0794 100644
--- a/src/tests/auth-tests.c
+++ b/src/tests/auth-tests.c
@@ -161,7 +161,7 @@ static void do_failed_login_test(uint32_t 
failed_login_attempts,
                                  int expected_counter,
                                  time_t expected_delay)
 {
-    struct sysdb_test_ctx *test_ctx;
+    struct sysdb_test_ctx *test_ctx = NULL;
     int ret;
     const char *val[2];
     val[1] = NULL;
-- 
1.7.2.3

From 7c2d41786cd8858fb9536836aec869e0437c5587 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sb...@redhat.com>
Date: Fri, 24 Sep 2010 10:31:22 +0200
Subject: [PATCH 2/2] Suppress some 'unchecked return value' warnings

---
 src/tests/files-tests.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/tests/files-tests.c b/src/tests/files-tests.c
index 2267a60..bd2de54 100644
--- a/src/tests/files-tests.c
+++ b/src/tests/files-tests.c
@@ -57,15 +57,22 @@ static void setup_files_test(void)
 static void teardown_files_test(void)
 {
     char *cmd = NULL;
+    int ret;
 
     /* OK this is crude but since the functions to remove tree are under 
test.. */
     if (dir_path && test_ctx) {
         cmd = talloc_asprintf(test_ctx, "/bin/rm -rf %s\n", dir_path);
-        system(cmd);
+        ret = system(cmd);
+        if (ret == -1) {
+            DEBUG(1, ("Removing [%s] failed.\n", dir_path));
+        }
     }
     if (dst_path && test_ctx) {
         cmd = talloc_asprintf(test_ctx, "/bin/rm -rf %s\n", dst_path);
-        system(cmd);
+        ret = system(cmd);
+        if (ret == -1) {
+            DEBUG(1, ("Removing [%s] failed.\n", dst_path));
+        }
     }
 
     /* clean up */
@@ -99,7 +106,7 @@ START_TEST(test_remove_tree)
     char origpath[PATH_MAX+1];
 
     errno = 0;
-    getcwd(origpath, PATH_MAX);
+    fail_unless(getcwd(origpath, PATH_MAX) == origpath, "Cannot getcwd\n");
     fail_unless(errno == 0, "Cannot getcwd\n");
 
     DEBUG(5, ("About to delete %s\n", dir_path));
@@ -150,7 +157,7 @@ START_TEST(test_simple_copy)
     int fd = -1;
 
     errno = 0;
-    getcwd(origpath, PATH_MAX);
+    fail_unless(getcwd(origpath, PATH_MAX) == origpath, "Cannot getcwd\n");
     fail_unless(errno == 0, "Cannot getcwd\n");
 
     /* create a file */
@@ -199,7 +206,7 @@ START_TEST(test_copy_symlink)
     struct stat statbuf;
 
     errno = 0;
-    getcwd(origpath, PATH_MAX);
+    fail_unless(getcwd(origpath, PATH_MAX) == origpath, "Cannot getcwd\n");
     fail_unless(errno == 0, "Cannot getcwd\n");
 
     /* create a subdir */
@@ -241,7 +248,7 @@ START_TEST(test_copy_node)
     struct stat statbuf;
 
     errno = 0;
-    getcwd(origpath, PATH_MAX);
+    fail_unless(getcwd(origpath, PATH_MAX) == origpath, "Cannot getcwd\n");
     fail_unless(errno == 0, "Cannot getcwd\n");
 
     /* create a node */
-- 
1.7.2.3

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to