diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2018-12-02 15:35:09 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-12-17 17:19:00 +0000 |
commit | c228f0c2d94c028619088c07b66f88488f7c3335 (patch) | |
tree | c312f100b984ae36ec2d4e865194743a47f44769 /xlators/debug/error-gen | |
parent | bdcb2d8497d77ff28cb031ae3992eb7ea0c90486 (diff) |
Don't depend on string options to be valid always
updates bz#1650403
Change-Id: Ib5a11e691599ce4bd93c1ed5aca6060592893961
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'xlators/debug/error-gen')
-rw-r--r-- | xlators/debug/error-gen/src/error-gen.c | 16 | ||||
-rw-r--r-- | xlators/debug/error-gen/src/error-gen.h | 1 |
2 files changed, 9 insertions, 8 deletions
diff --git a/xlators/debug/error-gen/src/error-gen.c b/xlators/debug/error-gen/src/error-gen.c index 3416d63fa20..8901e349e6f 100644 --- a/xlators/debug/error-gen/src/error-gen.c +++ b/xlators/debug/error-gen/src/error-gen.c @@ -1396,7 +1396,7 @@ error_gen_priv_dump(xlator_t *this) gf_proc_dump_write("op_count", "%d", conf->op_count); gf_proc_dump_write("failure_iter_no", "%d", conf->failure_iter_no); - gf_proc_dump_write("error_no", "%s", conf->error_no); + gf_proc_dump_write("error_no", "%d", conf->error_no_int); gf_proc_dump_write("random_failure", "%d", conf->random_failure); UNLOCK(&conf->lock); @@ -1430,6 +1430,7 @@ reconfigure(xlator_t *this, dict_t *options) eg_t *pvt = NULL; int32_t ret = 0; char *error_enable_fops = NULL; + char *error_no = NULL; double failure_percent_dbl = 0.0; if (!this || !this->private) @@ -1439,10 +1440,10 @@ reconfigure(xlator_t *this, dict_t *options) ret = -1; - GF_OPTION_RECONF("error-no", pvt->error_no, options, str, out); + GF_OPTION_RECONF("error-no", error_no, options, str, out); - if (pvt->error_no) - pvt->error_no_int = conv_errno_to_int(&pvt->error_no); + if (error_no) + pvt->error_no_int = conv_errno_to_int(&error_no); GF_OPTION_RECONF("failure", failure_percent_dbl, options, percent, out); @@ -1466,6 +1467,7 @@ init(xlator_t *this) eg_t *pvt = NULL; int32_t ret = 0; char *error_enable_fops = NULL; + char *error_no = NULL; double failure_percent_dbl = 0.0; if (!this->children || this->children->next) { @@ -1490,10 +1492,10 @@ init(xlator_t *this) ret = -1; - GF_OPTION_INIT("error-no", pvt->error_no, str, out); + GF_OPTION_INIT("error-no", error_no, str, out); - if (pvt->error_no) - pvt->error_no_int = conv_errno_to_int(&pvt->error_no); + if (error_no) + pvt->error_no_int = conv_errno_to_int(&error_no); GF_OPTION_INIT("failure", failure_percent_dbl, percent, out); diff --git a/xlators/debug/error-gen/src/error-gen.h b/xlators/debug/error-gen/src/error-gen.h index ffa09252d0f..2478cd5b21c 100644 --- a/xlators/debug/error-gen/src/error-gen.h +++ b/xlators/debug/error-gen/src/error-gen.h @@ -36,7 +36,6 @@ typedef struct { * It's just not worth blowing up the diff by changing it. */ int failure_iter_no; - char *error_no; int error_no_int; gf_boolean_t random_failure; gf_lock_t lock; |