All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/xenstored: Propagate correctly the error message from lu_start()
@ 2021-07-29 11:06 Julien Grall
  2021-07-30  7:07 ` Juergen Gross
  0 siblings, 1 reply; 5+ messages in thread
From: Julien Grall @ 2021-07-29 11:06 UTC (permalink / raw)
  To: xen-devel; +Cc: julien, Julien Grall, Ian Jackson, Wei Liu, Juergen Gross

From: Julien Grall <jgrall@amazon.com>

lu_start() will only set errno when it returns NULL. For all the
other cases, the value is unknown.

This means that when lu_start() returns an error message, it may not
be propagated to the client.

The check that errno is a non-zero value is now dropped and instead
the value is returned when no error message is provided. This
relies on errno to always be set when ret == NULL.

Fixes: af216a99fb ("tools/xenstore: add the basic framework for doing the live update")
Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_control.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index ff9863c17fa4..6b68b79faac7 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -795,10 +795,8 @@ static int do_control_lu(void *ctx, struct connection *conn,
 				return EINVAL;
 		}
 		ret = lu_start(ctx, conn, force, to);
-		if (errno)
-			return errno;
 		if (!ret)
-			return 0;
+			return errno;
 	} else {
 		errno = 0;
 		ret = lu_arch(ctx, conn, vec, num);
-- 
2.17.1



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

end of thread, other threads:[~2021-07-30 10:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 11:06 [PATCH] tools/xenstored: Propagate correctly the error message from lu_start() Julien Grall
2021-07-30  7:07 ` Juergen Gross
2021-07-29  9:34   ` [PATCH] tools/xenstored: Fix off-by-one in dump_state_nodes() Julien Grall
2021-07-30  7:02     ` Juergen Gross
2021-07-30 10:04       ` [PATCH] tools/xenstored: Fix off-by-one in dump_state_nodes() [and 3 more messages] Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.