diff options
author | Eric Blake | 2019-01-17 20:36:44 +0100 |
---|---|---|
committer | Eric Blake | 2019-01-21 22:49:51 +0100 |
commit | 43b510113bb2c6393c98a31dae9b57022a9c5636 (patch) | |
tree | 652a6194aae4111fc432159691cfc315fb0acbbc /nbd/server.c | |
parent | nbd/server: Favor [u]int64_t over off_t (diff) | |
download | qemu-43b510113bb2c6393c98a31dae9b57022a9c5636.tar.gz qemu-43b510113bb2c6393c98a31dae9b57022a9c5636.tar.xz qemu-43b510113bb2c6393c98a31dae9b57022a9c5636.zip |
qemu-nbd: Avoid strtol open-coding
Our copy-and-pasted open-coding of strtol handling forgot to
handle overflow conditions. Use qemu_strto*() instead.
In the case of --partition, since we insist on a user-supplied
partition to be non-zero, we can use 0 rather than -1 for our
initial value to distinguish when a partition is not being
served, for slightly more optimal code.
The error messages for out-of-bounds values are less specific,
but should not be a terrible loss in quality.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20190117193658.16413-8-eblake@redhat.com>
Diffstat (limited to 'nbd/server.c')
0 files changed, 0 insertions, 0 deletions