[sheepdog] [sheepdog/sheepdog] b72421: dog: Make "dog node recovery set-throttle" reject ...
Hitoshi Mitake
mitake.hitoshi at gmail.com
Thu Jul 28 09:30:28 CEST 2016
Branch: refs/heads/master
Home: https://github.com/sheepdog/sheepdog
Commit: b72421fe088e6190cf84c4d32eb5d1dfe8e2f03f
https://github.com/sheepdog/sheepdog/commit/b72421fe088e6190cf84c4d32eb5d1dfe8e2f03f
Author: Takashi Menjo <menjo.takashi at lab.ntt.co.jp>
Date: 2016-07-28 (Thu, 28 Jul 2016)
Changed paths:
M dog/node.c
Log Message:
-----------
dog: Make "dog node recovery set-throttle" reject negative values
This commit replaces strtoul/strtoull (pay attention to "u") with
strtol/strtoll (no "u") to check negative values right.
Passing negative values to "dog node recovery set-throttle,"
I got below. The case -1 is as I expected, but the case -2 is not:
$ dog node recovery get-throttle
max(0), interval (0)
$ dog node recovery set-throttle -- -1 -1
Invalid max (-1)
$ dog node recovery get-throttle
max (0), interval (0)
$ dog node recovery set-throttle -- -2 -2
$ dog node recovery get-throttle
max (4294967294), interval (18446744073709551614)
This is because of strtoul/strtoull. These functions accept a string
beginning with minus sign then, if non-negated value does not overflow,
return the conversion represented as an unsigned value without error.
So I got (uint32_t)(unsigned long)-2 and (uint64_t)(unsigned long long)-2.
Signed-off-by: Takashi Menjo <menjo.takashi at lab.ntt.co.jp>
Commit: 5224544e2c2254e02813d5d63e36cd52ce2fca2f
https://github.com/sheepdog/sheepdog/commit/5224544e2c2254e02813d5d63e36cd52ce2fca2f
Author: Hitoshi Mitake <mitake.hitoshi at gmail.com>
Date: 2016-07-28 (Thu, 28 Jul 2016)
Changed paths:
M dog/node.c
Log Message:
-----------
Merge pull request #293 from tmenjo/fix-set-throttle
dog: Make "dog node recovery set-throttle" reject negative values
Compare: https://github.com/sheepdog/sheepdog/compare/d9259db6cd7e...5224544e2c22
More information about the sheepdog
mailing list