qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 2/2] qemu-io: Fix if scoping bug
@ 2011-06-11  3:29 Devin Nakamura
  2011-06-14  8:42 ` Markus Armbruster
  0 siblings, 1 reply; 6+ messages in thread
From: Devin Nakamura @ 2011-06-11  3:29 UTC (permalink / raw)
  To: qemu-devel

Fix a bug caused by lack of braces in if statement

Signed-off-by: Devin Nakamura <devin122@gmail.com>
---
 qemu-io.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/qemu-io.c b/qemu-io.c
index 53adb76..1c4f684 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -433,12 +433,12 @@ static int read_f(int argc, char **argv)
         return 0;
     }

-    if (!pflag)
+    if (!pflag){
         if (offset & 0x1ff) {
             printf("offset %" PRId64 " is not sector aligned\n",
                    offset);
             return 0;
-
+        }
         if (count & 0x1ff) {
             printf("count %d is not sector aligned\n",
                    count);
-- 
1.7.6.rc1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] qemu-io: Fix if scoping bug
  2011-06-11  3:29 [Qemu-devel] [PATCH 2/2] qemu-io: Fix if scoping bug Devin Nakamura
@ 2011-06-14  8:42 ` Markus Armbruster
  0 siblings, 0 replies; 6+ messages in thread
From: Markus Armbruster @ 2011-06-14  8:42 UTC (permalink / raw)
  To: Devin Nakamura; +Cc: qemu-devel

Devin Nakamura <devin122@gmail.com> writes:

> Fix a bug caused by lack of braces in if statement

You describe the bug's cause.  That's good.  Please also describe the
bug's effect, i.e. what exactly is broken for users.

>
> Signed-off-by: Devin Nakamura <devin122@gmail.com>
> ---
>  qemu-io.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/qemu-io.c b/qemu-io.c
> index 53adb76..1c4f684 100644
> --- a/qemu-io.c
> +++ b/qemu-io.c
> @@ -433,12 +433,12 @@ static int read_f(int argc, char **argv)
>          return 0;
>      }
>
> -    if (!pflag)
> +    if (!pflag){

Put a space between ) and {

>          if (offset & 0x1ff) {
>              printf("offset %" PRId64 " is not sector aligned\n",
>                     offset);
>              return 0;
> -
> +        }
>          if (count & 0x1ff) {
>              printf("count %d is not sector aligned\n",
>                     count);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 2/2] qemu-io: Fix if scoping bug
  2011-07-11  5:25 [Qemu-devel] [PATCH 1/2] qemu-io: Fix formatting Devin Nakamura
@ 2011-07-11  5:25 ` Devin Nakamura
  2011-07-11  9:47   ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: Devin Nakamura @ 2011-07-11  5:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Devin Nakamura

Fix a bug caused by lack of braces in if statement

Lack of braces means that if(count & 0x1ff) is never reached

Conflicts:

	qemu-io.c

Signed-off-by: Devin Nakamura <devin122@gmail.com>
---
 qemu-io.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/qemu-io.c b/qemu-io.c
index e484f40..85cfe27 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -449,7 +449,7 @@ static int read_f(int argc, char **argv)
         return 0;
     }
 
-    if (!pflag)
+    if (!pflag) {
         if (offset & 0x1ff) {
             printf("offset %" PRId64 " is not sector aligned\n",
                    offset);
-- 
1.7.6.rc1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] qemu-io: Fix if scoping bug
  2011-07-11  5:25 ` [Qemu-devel] [PATCH 2/2] qemu-io: Fix if scoping bug Devin Nakamura
@ 2011-07-11  9:47   ` Stefan Hajnoczi
  2011-07-11 13:18     ` Kevin Wolf
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2011-07-11  9:47 UTC (permalink / raw)
  To: Devin Nakamura; +Cc: qemu-devel

On Mon, Jul 11, 2011 at 6:25 AM, Devin Nakamura <devin122@gmail.com> wrote:
> diff --git a/qemu-io.c b/qemu-io.c
> index e484f40..85cfe27 100644
> --- a/qemu-io.c
> +++ b/qemu-io.c
> @@ -449,7 +449,7 @@ static int read_f(int argc, char **argv)
>         return 0;
>     }
>
> -    if (!pflag)
> +    if (!pflag) {
>         if (offset & 0x1ff) {
>             printf("offset %" PRId64 " is not sector aligned\n",
>                    offset);

Wait, this is not enough.  The indentation and curlies are so broken
here :).  The if (offset & 0x1ff) statement needs a closing curly.

The code should be:
if (!pflag) {
    if (offset & 0x1ff) {
                    printf("offset %" PRId64 " is not sector aligned\n",
                           offset);
        return 0;
    }

    if (count & 0x1ff) {
        printf("count %d is not sector aligned\n",
            count);
        return 0;
    }
}

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] qemu-io: Fix if scoping bug
  2011-07-11  9:47   ` Stefan Hajnoczi
@ 2011-07-11 13:18     ` Kevin Wolf
  2011-07-11 13:18       ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Wolf @ 2011-07-11 13:18 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Devin Nakamura, qemu-devel

Am 11.07.2011 11:47, schrieb Stefan Hajnoczi:
> On Mon, Jul 11, 2011 at 6:25 AM, Devin Nakamura <devin122@gmail.com> wrote:
>> diff --git a/qemu-io.c b/qemu-io.c
>> index e484f40..85cfe27 100644
>> --- a/qemu-io.c
>> +++ b/qemu-io.c
>> @@ -449,7 +449,7 @@ static int read_f(int argc, char **argv)
>>         return 0;
>>     }
>>
>> -    if (!pflag)
>> +    if (!pflag) {
>>         if (offset & 0x1ff) {
>>             printf("offset %" PRId64 " is not sector aligned\n",
>>                    offset);
> 
> Wait, this is not enough.  The indentation and curlies are so broken
> here :).  The if (offset & 0x1ff) statement needs a closing curly.

It's actually there, patch 1 already contains it. Breaks bisectability,
of course.

Kevin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] qemu-io: Fix if scoping bug
  2011-07-11 13:18     ` Kevin Wolf
@ 2011-07-11 13:18       ` Stefan Hajnoczi
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2011-07-11 13:18 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: Devin Nakamura, qemu-devel

On Mon, Jul 11, 2011 at 2:18 PM, Kevin Wolf <kwolf@redhat.com> wrote:
> Am 11.07.2011 11:47, schrieb Stefan Hajnoczi:
>> On Mon, Jul 11, 2011 at 6:25 AM, Devin Nakamura <devin122@gmail.com> wrote:
>>> diff --git a/qemu-io.c b/qemu-io.c
>>> index e484f40..85cfe27 100644
>>> --- a/qemu-io.c
>>> +++ b/qemu-io.c
>>> @@ -449,7 +449,7 @@ static int read_f(int argc, char **argv)
>>>         return 0;
>>>     }
>>>
>>> -    if (!pflag)
>>> +    if (!pflag) {
>>>         if (offset & 0x1ff) {
>>>             printf("offset %" PRId64 " is not sector aligned\n",
>>>                    offset);
>>
>> Wait, this is not enough.  The indentation and curlies are so broken
>> here :).  The if (offset & 0x1ff) statement needs a closing curly.
>
> It's actually there, patch 1 already contains it. Breaks bisectability,
> of course.

Devin,
Please make patch 1 only fix formatting and move any other changes
into later patches.

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-07-11 13:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-11  3:29 [Qemu-devel] [PATCH 2/2] qemu-io: Fix if scoping bug Devin Nakamura
2011-06-14  8:42 ` Markus Armbruster
  -- strict thread matches above, loose matches on Subject: below --
2011-07-11  5:25 [Qemu-devel] [PATCH 1/2] qemu-io: Fix formatting Devin Nakamura
2011-07-11  5:25 ` [Qemu-devel] [PATCH 2/2] qemu-io: Fix if scoping bug Devin Nakamura
2011-07-11  9:47   ` Stefan Hajnoczi
2011-07-11 13:18     ` Kevin Wolf
2011-07-11 13:18       ` Stefan Hajnoczi

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).