]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
socket: don't free msgfds if error equals EAGAIN
authorlinzhecheng <linzhecheng@huawei.com>
Tue, 29 May 2018 02:52:40 +0000 (10:52 +0800)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 28 Jun 2018 12:36:59 +0000 (13:36 +0100)
If we see EAGAIN, no data was sent over the socket, so we still have to
retry sending of msgfds next time.

Signed-off-by: linzhecheng <linzhecheng@huawei.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
chardev/char-socket.c

index 159e69c3b15a58f9593374853a36cd752c69f31b..17519ec58991ba24cb44bccf58e8f52e584ccdce 100644 (file)
@@ -134,8 +134,8 @@ static int tcp_chr_write(Chardev *chr, const uint8_t *buf, int len)
                                         s->write_msgfds,
                                         s->write_msgfds_num);
 
-        /* free the written msgfds, no matter what */
-        if (s->write_msgfds_num) {
+        /* free the written msgfds in any cases other than errno==EAGAIN */
+        if (EAGAIN != errno && s->write_msgfds_num) {
             g_free(s->write_msgfds);
             s->write_msgfds = 0;
             s->write_msgfds_num = 0;