|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 1/2] public/io: xs_wire: Document that EINVAL should always be first in xsd_errors
On 27.06.22 14:36, Julien Grall wrote:
What about another approach, like:
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -746,16 +746,17 @@ unsigned int get_strings(struct buffered_data *data,
static void send_error(struct connection *conn, int error)
{
unsigned int i;
+ char *err = NULL;
for (i = 0; error != xsd_errors[i].errnum; i++) {
if (i == ARRAY_SIZE(xsd_errors) - 1) {
eprintf("xenstored: error %i untranslatable", error);
- i = 0; /* EINVAL */
+ err = "EINVAL";
break;
}
}
- send_reply(conn, XS_ERROR, xsd_errors[i].errstring,
- strlen(xsd_errors[i].errstring) + 1);
+ err = err ? : xsd_errors[i].errstring;
+ send_reply(conn, XS_ERROR, err, strlen(err) + 1);
}
void send_reply(struct connection *conn, enum xsd_sockmsg_type type,
Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc Attachment:
OpenPGP_signature
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |