vzctl set --devices: option argument parsing fixes
Here is one important fix, plus a number of improvements
for parse_devices_arg().
(1) FIX parsing "permissions" (i.e. the last) parameter.
Before this patch, documented value 'none' was not
really recognized properly because string size was 3
(i.e. for up to 2 characters and a '\0' byte).
Now, use size of 6 (up to 5 characters and a '\0' byte)
to allow for values like 'none' (valid) and 'nones' (invalid).
Note that 5 chars are needed to distinguish between
'none' and 'nones' and so detect invalid input.
NOTE this bug went unnoticed because of another bug,
which was fixed by previous git commit 287cc9d96b.
(2) Use 'int' not 'unsigned long' for major and minor numbers.
(3) Rename 'major' to 'major_str' and 'val' to 'major'.
(4) Make a string for storing minor number 16 characters in width.
This allows for parsing INT_MAX which is 10 characters.
(5) Use char to store type, fix comparisons and sscanf accordingly.
(6) Use parse_int to convert major_str to major.
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
1 file changed