From: Stefan Hajnoczi <stefanha@redhat.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: Michael Roth <michael.roth@amd.com>,
Kostiantyn Kostiuk <kkostiuk@redhat.com>,
qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Subject: Re: [PATCH trivial] qga: correctly write to /sys/power/state on linux
Date: Tue, 5 Aug 2025 14:56:52 -0400 [thread overview]
Message-ID: <20250805185652.GA21648@fedora> (raw)
In-Reply-To: <20250801115316.6845-1-mjt@tls.msk.ru>
[-- Attachment #1: Type: text/plain, Size: 1067 bytes --]
On Fri, Aug 01, 2025 at 02:53:14PM +0300, Michael Tokarev wrote:
> Commit v9.0.0-343-g2048129625 introduced usage of
> g_file_set_contents() function to write to /sys/power/state.
> This function uses G_FILE_SET_CONTENTS_CONSISTENT flag to
> g_file_set_contents_full(), which is implemented by creating
> a temp file in the same directory and renaming it to the final
> destination. Which is not how sysfs works.
>
> Here, there's not a big deal to do open/write/close - it becomes
> almost the same as using g_file_set_contents[_full](). But it
> does not have surprises like this.
>
> Also, since this is linux code, it should be ok to use %m in
> the error reporting function.
>
> Fixes: 2048129625 "qga/commands-posix: don't do fork()/exec() when suspending via sysfs"
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3057
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
> qga/commands-linux.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2025-08-05 18:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-01 11:53 [PATCH trivial] qga: correctly write to /sys/power/state on linux Michael Tokarev
2025-08-05 18:56 ` Stefan Hajnoczi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250805185652.GA21648@fedora \
--to=stefanha@redhat.com \
--cc=kkostiuk@redhat.com \
--cc=michael.roth@amd.com \
--cc=mjt@tls.msk.ru \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).