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 <m...@tls.msk.ru>
> ---
>  qga/commands-linux.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com>

Attachment: signature.asc
Description: PGP signature

Reply via email to