qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] qemu-char: Print strerror message on failure


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH] qemu-char: Print strerror message on failure
Date: Wed, 22 Jun 2011 12:24:46 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10

On 06/21/2011 11:18 AM, Kevin Wolf wrote:
Am 21.06.2011 18:09, schrieb Markus Armbruster:
Kevin Wolf<address@hidden>  writes:

The only way for chardev drivers to communicate an error was to return a NULL
pointer, which resulted in an error message that said _that_ something went
wrong, but not _why_.

This patch changes the interface to return 0/-errno and updates
qemu_chr_open_opts to use strerror to display a more helpful error message.

Returning the result through a pointer is awkward.  What about stuffing
the error code into errno?

I generally like it better to return error codes explicitly instead of
storing them in some global variable where it tends to be trampled over
before you print the message. But if people prefer it that way, I can
redo the patch.

I think passing a pointer to an int to receive the error is best. That way a NULL can be passed to indicate that the caller doesn't care.

This matches the Error model that we're proposing else where.

Regards,

Anthony Liguori


Kevin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]