diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c index 53328606658c357816fc0f9bb82c4fef1a059f56..a416876e492fc2f7854edb191676eacd66466e4d 100644 --- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c +++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c @@ -3078,7 +3078,7 @@ extern List acct_storage_p_modify_accounts( if(acct->description) xstrfmtcat(vals, ", description='%s'", acct->description); if(acct->organization) - xstrfmtcat(vals, ", organization='%u'", acct->organization); + xstrfmtcat(vals, ", organization='%s'", acct->organization); if(acct->qos_list && list_count(acct->qos_list)) { char *tmp_qos = NULL; diff --git a/src/sacctmgr/file_functions.c b/src/sacctmgr/file_functions.c index 2c6267f4d5754d790d32207af9de725f84667de2..a278ccf39de9e958836aca6d764acc4d9fb92655 100644 --- a/src/sacctmgr/file_functions.c +++ b/src/sacctmgr/file_functions.c @@ -675,9 +675,8 @@ static int _mod_acct(sacctmgr_file_opts_t *file_opts, if(file_opts->desc) desc = xstrdup(file_opts->desc); - else - desc = xstrdup(file_opts->name); - if(strcmp(desc, acct->description)) { + + if(desc && strcmp(desc, acct->description)) { printf(" Changed description for account " "'%s' from '%s' to '%s'\n", acct->name, @@ -685,15 +684,13 @@ static int _mod_acct(sacctmgr_file_opts_t *file_opts, desc); mod_acct.description = desc; changed = 1; - } + } else + xfree(desc); if(file_opts->org) org = xstrdup(file_opts->org); - else if(strcmp(parent, "root")) - org = xstrdup(parent); - else - org = xstrdup(file_opts->name); - if(strcmp(org, acct->organization)) { + + if(org && strcmp(org, acct->organization)) { printf(" Changed organization for account '%s' " "from '%s' to '%s'\n", acct->name, @@ -701,7 +698,8 @@ static int _mod_acct(sacctmgr_file_opts_t *file_opts, org); mod_acct.organization = org; changed = 1; - } + } else + xfree(org); if(acct->qos_list && list_count(acct->qos_list) && file_opts->qos_list && list_count(file_opts->qos_list)) { @@ -810,10 +808,8 @@ static int _mod_user(sacctmgr_file_opts_t *file_opts, if(file_opts->def_acct) def_acct = xstrdup(file_opts->def_acct); - else - def_acct = xstrdup(parent); - if(strcmp(def_acct, user->default_acct)) { + if(def_acct && strcmp(def_acct, user->default_acct)) { printf(" Changed User '%s' " "default account '%s' -> '%s'\n", user->name,