[SCSI] scsi_debug: remove temporary hack around sscanf for negative values

sscanf can handle negative values.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:
FUJITA Tomonori 2008-03-20 11:09:15 +09:00 committed by James Bottomley
parent 1c353f7d61
commit f3df41cff4

View file

@ -2682,20 +2682,9 @@ static ssize_t sdebug_add_host_store(struct device_driver * ddp,
const char * buf, size_t count)
{
int delta_hosts;
char work[20];
if (1 != sscanf(buf, "%10s", work))
if (sscanf(buf, "%d", &delta_hosts) != 1)
return -EINVAL;
{ /* temporary hack around sscanf() problem with -ve nums */
int neg = 0;
if ('-' == *work)
neg = 1;
if (1 != sscanf(work + neg, "%d", &delta_hosts))
return -EINVAL;
if (neg)
delta_hosts = -delta_hosts;
}
if (delta_hosts > 0) {
do {
sdebug_add_adapter();