diff options
| -rw-r--r-- | libglusterfs/src/options.c | 10 | ||||
| -rw-r--r-- | tests/bugs/bug-1111557.t | 12 | ||||
| -rw-r--r-- | xlators/debug/io-stats/src/io-stats.c | 3 | 
3 files changed, 25 insertions, 0 deletions
diff --git a/libglusterfs/src/options.c b/libglusterfs/src/options.c index f63c60476da..9edb7c03df2 100644 --- a/libglusterfs/src/options.c +++ b/libglusterfs/src/options.c @@ -58,6 +58,7 @@ xlator_option_validate_int (xlator_t *xl, const char *key, const char *value,                              volume_option_t *opt, char **op_errstr)  {          long long inputll = 0; +        unsigned long long uinputll = 0;          int       ret = -1;          char      errstr[256]; @@ -70,6 +71,15 @@ xlator_option_validate_int (xlator_t *xl, const char *key, const char *value,                  goto out;          } +        /* Handle '-0' */ +        if ((inputll == 0) && (gf_string2ulonglong (value, &uinputll) != 0)) { +                snprintf (errstr, 256, +                          "invalid number format \"%s\" in option \"%s\"", +                          value, key); +                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                goto out; +        } +          if ((opt->min == 0) && (opt->max == 0) &&              (opt->validate == GF_OPT_VALIDATE_BOTH)) {                  gf_log (xl->name, GF_LOG_TRACE, diff --git a/tests/bugs/bug-1111557.t b/tests/bugs/bug-1111557.t new file mode 100644 index 00000000000..656b6e6519b --- /dev/null +++ b/tests/bugs/bug-1111557.t @@ -0,0 +1,12 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0}{0} +TEST $CLI volume set $V0 diagnostics.brick-log-buf-size 0 +TEST ! $CLI volume set $V0 diagnostics.brick-log-buf-size -0 +cleanup diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 2a5eedefbd3..6a2aa586ab1 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -2838,6 +2838,9 @@ init (xlator_t *this)          this->private = conf;          ret = 0;  out: +        if (!this->private) +                ret = -1; +          return ret;  }  | 
