qemu-io: reject invalid pattern
authorChristoph Hellwig <hch@lst.de>
Sun, 19 Jul 2009 23:19:25 +0000 (01:19 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 22 Jul 2009 15:58:47 +0000 (10:58 -0500)
commitc66c370a7498a0f83fdd38052e90134f594ebc48
treedfd7df71b93c243ab24abd06447525532cb7cec3
parent098dcc7577c101f26d755a064f331694744346aa
qemu-io: reject invalid pattern

Replace the use of atoi which is used for pattern parsing currently with
strtol.  Atoi won't parse sedecimal pattern values (it always returns 0),
but qemu-iotests use such pattern values.  Also reject every pattern
that is not a unsigned char as we pass the pattern to memset which
expect a bye value (despite having the pattern argument declared as int).

Based on an earlier patch by Stefan Weil which did not include the
error handling.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-io.c