qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <weil@mail.berlios.de>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: Christoph Hellwig <hch@lst.de>
Subject: [Qemu-devel] [PATCH] qemu-io: Fix parsing of pattern arguments
Date: Sat, 11 Jul 2009 14:35:44 +0200	[thread overview]
Message-ID: <1247315744-5911-1-git-send-email-weil@mail.berlios.de> (raw)
In-Reply-To: <1247315696-5877-1-git-send-email-weil@mail.berlios.de>

atoi won't parse sedecimal pattern values (it always returns 0).
The qemu-iotests use such pattern values, to strtol is needed
to get correct results.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 qemu-io.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/qemu-io.c b/qemu-io.c
index d0927ba..36fb77a 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -286,7 +286,7 @@ read_f(int argc, char **argv)
 			break;
 		case 'P':
 			Pflag = 1;
-			pattern = atoi(optarg);
+			pattern = strtol(optarg, NULL, 0);
 			break;
 		case 'q':
 			qflag = 1;
@@ -444,7 +444,7 @@ readv_f(int argc, char **argv)
 			break;
 		case 'P':
 			Pflag = 1;
-			pattern = atoi(optarg);
+			pattern = strtol(optarg, NULL, 0);
 			break;
 		case 'q':
 			qflag = 1;
@@ -565,7 +565,7 @@ write_f(int argc, char **argv)
 			pflag = 1;
 			break;
 		case 'P':
-			pattern = atoi(optarg);
+			pattern = strtol(optarg, NULL, 0);
 			break;
 		case 'q':
 			qflag = 1;
@@ -685,7 +685,7 @@ writev_f(int argc, char **argv)
 			qflag = 1;
 			break;
 		case 'P':
-			pattern = atoi(optarg);
+			pattern = strtol(optarg, NULL, 0);
 			break;
 		default:
 			return command_usage(&writev_cmd);
@@ -859,7 +859,7 @@ aio_read_f(int argc, char **argv)
 			break;
 		case 'P':
 			ctx->Pflag = 1;
-			ctx->pattern = atoi(optarg);
+			ctx->pattern = strtol(optarg, NULL, 0);
 			break;
 		case 'q':
 			ctx->qflag = 1;
@@ -959,7 +959,7 @@ aio_write_f(int argc, char **argv)
 			ctx->qflag = 1;
 			break;
 		case 'P':
-			pattern = atoi(optarg);
+			pattern = strtol(optarg, NULL, 0);
 			break;
 		default:
 			free(ctx);
-- 
1.5.6.5

  reply	other threads:[~2009-07-11 12:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-11 12:34 [Qemu-devel] [PATCH] qemu-iotests: fix pattern for write test Stefan Weil
2009-07-11 12:35 ` Stefan Weil [this message]
2009-07-14 21:24   ` [Qemu-devel] [PATCH] qemu-io: Fix parsing of pattern arguments Christoph Hellwig
2009-07-14 21:29     ` Stefan Weil
2009-07-14 21:20 ` [Qemu-devel] [PATCH] qemu-iotests: fix pattern for write test Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1247315744-5911-1-git-send-email-weil@mail.berlios.de \
    --to=weil@mail.berlios.de \
    --cc=hch@lst.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).