[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libvir] fix another bug exposed by a compiler warning



Mark McLoughlin <markmc redhat com> wrote:
> On Mon, 2008-03-03 at 17:35 +0100, Jim Meyering wrote:
>
>> -    virerr = __virErrorMsg(code, (errorMessage[0] ? errorMessage[0] : NULL));
>> +    virerr = __virErrorMsg(code, (!errorMessage[0] ? errorMessage : NULL));
>
> 	That can't be right, surely? You mean:
>
>   (errorMessage[0] ? errorMessage : NULL)
>
> 	right?

Argh.  Of course.  Thanks!
Corrected ChangeLog entry and patch:

	Don't use first byte of string as a pointer.
	* src/qemu_conf.c (qemudReportError): Use the pointer, errorMessage,
	not its first byte, errorMessage[0].

Signed-off-by: Jim Meyering <meyering redhat com>
---
 src/qemu_conf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index eead0bc..e54da5b 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -68,7 +68,7 @@ void qemudReportError(virConnectPtr conn,
         errorMessage[0] = '\0';
     }

-    virerr = __virErrorMsg(code, (errorMessage[0] ? errorMessage[0] : NULL));
+    virerr = __virErrorMsg(code, (errorMessage[0] ? errorMessage : NULL));
     __virRaiseError(conn, dom, net, VIR_FROM_QEMU, code, VIR_ERR_ERROR,
                     virerr, errorMessage, NULL, -1, -1, virerr, errorMessage);
 }
--
1.5.4.3.366.g55277


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]