* [PATCH] qga: fix uname() return value check in guest-get-osinfo
@ 2026-10-30 23:07 Brad Smith
2026-10-31 11:43 ` Roman Bogorodskiy
0 siblings, 1 reply; 2+ messages in thread
From: Brad Smith @ 2026-10-30 23:07 UTC (permalink / raw)
To: Michael Roth, Kostiantyn Kostiuk; +Cc: qemu-devel
qga: fix uname() return value check in guest-get-osinfo
POSIX only specifies that uname() returns a non-negative value on
success. Solaris returns 1, so guest-get-osinfo treated every
successful call as a failure and reported a stale errno.
Check for a negative return value instead, as linux-user/uname.c
already does.
Signed-off-by: Brad Smith <brad@comstyle.com>
---
qga/commands-posix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index dcc683f6c9..23abaf1956 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -1322,7 +1322,7 @@ GuestOSInfo *qmp_guest_get_osinfo(Error **errp)
info = g_new0(GuestOSInfo, 1);
- if (uname(&kinfo) != 0) {
+ if (uname(&kinfo) < 0) {
error_setg_errno(errp, errno, "uname failed");
} else {
info->kernel_version = g_strdup(kinfo.version);
--
2.56.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] qga: fix uname() return value check in guest-get-osinfo
2026-10-30 23:07 [PATCH] qga: fix uname() return value check in guest-get-osinfo Brad Smith
@ 2026-10-31 11:43 ` Roman Bogorodskiy
0 siblings, 0 replies; 2+ messages in thread
From: Roman Bogorodskiy @ 2026-10-31 11:43 UTC (permalink / raw)
To: Brad Smith; +Cc: Michael Roth, Kostiantyn Kostiuk, qemu-devel
Brad Smith wrote:
> qga: fix uname() return value check in guest-get-osinfo
>
> POSIX only specifies that uname() returns a non-negative value on
> success. Solaris returns 1, so guest-get-osinfo treated every
> successful call as a failure and reported a stale errno.
>
> Check for a negative return value instead, as linux-user/uname.c
> already does.
>
> Signed-off-by: Brad Smith <brad@comstyle.com>
> ---
> qga/commands-posix.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index dcc683f6c9..23abaf1956 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -1322,7 +1322,7 @@ GuestOSInfo *qmp_guest_get_osinfo(Error **errp)
>
> info = g_new0(GuestOSInfo, 1);
>
> - if (uname(&kinfo) != 0) {
> + if (uname(&kinfo) < 0) {
> error_setg_errno(errp, errno, "uname failed");
> } else {
> info->kernel_version = g_strdup(kinfo.version);
> --
> 2.56.0
>
>
Reviewed-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-31 11:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-30 23:07 [PATCH] qga: fix uname() return value check in guest-get-osinfo Brad Smith
2026-10-31 11:43 ` Roman Bogorodskiy
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.