qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix crash at startup
@ 2009-01-19  6:58 Lionel Landwerlin
  2009-01-19  7:16 ` Laurent Desnogues
  0 siblings, 1 reply; 2+ messages in thread
From: Lionel Landwerlin @ 2009-01-19  6:58 UTC (permalink / raw)
  To: qemu-devel

Fix crash at startup

Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr>
---
 exec.c |   3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/exec.c b/exec.c
index faa6333..7c9d7dc 100644
--- a/exec.c
+++ b/exec.c
@@ -2066,2 +2066,2 @@ void page_dump(FILE *f)
     int i, j, prot, prot1;
     PageDesc *p;

+    if (!f)
+        return;
+
     fprintf(f, "%-8s %-8s %-8s %s\n",
             "start", "end", "size", "prot");
     start = -1;
--
1.5.6.5

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

* Re: [Qemu-devel] [PATCH] Fix crash at startup
  2009-01-19  6:58 [Qemu-devel] [PATCH] Fix crash at startup Lionel Landwerlin
@ 2009-01-19  7:16 ` Laurent Desnogues
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Desnogues @ 2009-01-19  7:16 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 671 bytes --]

On Mon, Jan 19, 2009 at 7:58 AM, Lionel Landwerlin
<lionel.landwerlin@openwide.fr> wrote:
> Fix crash at startup
>
> Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr>
> ---
>  exec.c |   3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index faa6333..7c9d7dc 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2066,2 +2066,2 @@ void page_dump(FILE *f)
>     int i, j, prot, prot1;
>     PageDesc *p;
>
> +    if (!f)
> +        return;
> +

I would prefer a slightly different approach like the attached patch,
but that's just personal taste :-)


Laurent

Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: log.patch --]
[-- Type: text/x-patch; name=log.patch, Size: 478 bytes --]

Index: qemu-log.h
===================================================================
--- qemu-log.h	(revision 6367)
+++ qemu-log.h	(working copy)
@@ -63,10 +63,12 @@
         disas(logfile, (start), (len))
 
 /* page_dump() output to the log file: */
-#define log_page_dump() page_dump(logfile)
+#define log_page_dump() do {     \
+        if (logfile)             \
+            page_dump(logfile);  \
+    } while (0)
 
 
-
 /* Maintenance: */
 
 /* fflush() the log file */

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

end of thread, other threads:[~2009-01-19  7:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-19  6:58 [Qemu-devel] [PATCH] Fix crash at startup Lionel Landwerlin
2009-01-19  7:16 ` Laurent Desnogues

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