summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Zeleny <jzeleny@redhat.com>2010-09-02 14:35:58 +0200
committerStephen Gallagher <sgallagh@redhat.com>2010-09-08 09:36:22 -0400
commit4f6a396fcf16f97b2abc3d0cba10e9aa9bc38619 (patch)
treeb75a38b0012a84fc89419095c0ab2d392a2ed490
parent039d997b19cffa2f5428bb3d85669ebc5888307a (diff)
downloadsssd-4f6a396fcf16f97b2abc3d0cba10e9aa9bc38619.tar.gz
sssd-4f6a396fcf16f97b2abc3d0cba10e9aa9bc38619.tar.xz
sssd-4f6a396fcf16f97b2abc3d0cba10e9aa9bc38619.zip
Dead assignments cleanup in various places in SSSD
Three assignments deleted, two return code inspection added. Also found and fixed one critical bug caused by dead assignment. Ticket: #590
-rw-r--r--src/confdb/confdb.c1
-rw-r--r--src/confdb/confdb_setup.c5
-rw-r--r--src/db/sysdb.c3
-rw-r--r--src/monitor/monitor.c3
-rw-r--r--src/util/backup_file.c2
5 files changed, 8 insertions, 6 deletions
diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c
index 877b80ac7..eebc2cd3d 100644
--- a/src/confdb/confdb.c
+++ b/src/confdb/confdb.c
@@ -862,7 +862,6 @@ int confdb_get_domains(struct confdb_ctx *cdb,
if (ret) {
DEBUG(0, ("Error (%d [%s]) retrieving domain [%s], skipping!\n",
ret, strerror(ret), domlist[i]));
- ret = EOK;
continue;
}
diff --git a/src/confdb/confdb_setup.c b/src/confdb/confdb_setup.c
index b2ac7e163..f98a69772 100644
--- a/src/confdb/confdb_setup.c
+++ b/src/confdb/confdb_setup.c
@@ -133,7 +133,6 @@ static int confdb_create_ldif(TALLOC_CTX *mem_ctx,
int ret, i, j;
char *ldif;
char *tmp_ldif;
- char *writer;
char **sections;
int section_count;
char *dn;
@@ -159,7 +158,6 @@ static int confdb_create_ldif(TALLOC_CTX *mem_ctx,
}
memcpy(ldif, CONFDB_INTERNAL_LDIF, ldif_len);
- writer = ldif+ldif_len;
/* Read in the collection and convert it to an LDIF */
/* Get the list of sections */
@@ -273,7 +271,7 @@ error:
int confdb_init_db(const char *config_file, struct confdb_ctx *cdb)
{
- int ret, i;
+ int ret;
int fd = -1;
struct collection_item *sssd_config = NULL;
struct collection_item *error_list = NULL;
@@ -397,7 +395,6 @@ int confdb_init_db(const char *config_file, struct confdb_ctx *cdb)
DEBUG(7, ("LDIF file to import: \n%s", config_ldif));
- i=0;
while ((ldif = ldb_ldif_read_string(cdb->ldb, (const char **)&config_ldif))) {
ret = ldb_add(cdb->ldb, ldif->msg);
if (ret != LDB_SUCCESS) {
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index 5a7626f46..4e1243c08 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -193,6 +193,9 @@ int sysdb_attrs_add_val(struct sysdb_attrs *attrs,
int ret;
ret = sysdb_attrs_get_el(attrs, name, &el);
+ if (ret != EOK) {
+ return ret;
+ }
vals = talloc_realloc(attrs->a, el->values,
struct ldb_val, el->num_values+1);
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index caf405612..1c2a058e5 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -981,6 +981,9 @@ static int add_new_service(struct mt_ctx *ctx, const char *name)
struct mt_svc *svc;
ret = get_service_config(ctx, name, &svc);
+ if (ret != EOK) {
+ return ret;
+ }
ret = start_service(svc);
if (ret != EOK) {
diff --git a/src/util/backup_file.c b/src/util/backup_file.c
index 990793278..fb1604b9e 100644
--- a/src/util/backup_file.c
+++ b/src/util/backup_file.c
@@ -96,8 +96,8 @@ int backup_file(const char *src_file, int dbglvl)
count = num;
+ pos = 0;
while (count > 0) {
- pos = 0;
errno = 0;
num = write(dst_fd, &buf[pos], count);
if (num < 0) {