]> git.proxmox.com Git - mirror_qemu.git/commit
chardev/char-socket: tcp_chr_recv: don't clobber errno
authorRoman Kagan <rvkagan@yandex-team.ru>
Thu, 11 Nov 2021 15:33:46 +0000 (18:33 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 7 Jan 2022 10:19:55 +0000 (05:19 -0500)
commite87975051ee6071dec12d318e45a28d4770c2dd0
tree20596476904cccdc7d1a4e8e30347cb64d0998d8
parentb7107e758f4ecdd8f07ede3f093cbbfdb623e865
chardev/char-socket: tcp_chr_recv: don't clobber errno

tcp_chr_recv communicates the specific error condition to the caller via
errno.  However, after setting it, it may call into some system calls or
library functions which can clobber the errno.

Avoid this by moving the errno assignment to the end of the function.

Signed-off-by: Roman Kagan <rvkagan@yandex-team.ru>
Message-Id: <20211111153354.18807-3-rvkagan@yandex-team.ru>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
chardev/char-socket.c