Re: fix another bug exposed by a compiler warning

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

 



Mark McLoughlin <markmc@xxxxxxxxxx> 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@xxxxxxxxxx>
---
 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

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]