aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chardev/char-socket.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index 17519ec589..efbad6ee7c 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -134,8 +134,11 @@ static int tcp_chr_write(Chardev *chr, const uint8_t *buf, int len)
s->write_msgfds,
s->write_msgfds_num);
- /* free the written msgfds in any cases other than errno==EAGAIN */
- if (EAGAIN != errno && s->write_msgfds_num) {
+ /* free the written msgfds in any cases
+ * other than ret < 0 && errno == EAGAIN
+ */
+ if (!(ret < 0 && EAGAIN == errno)
+ && s->write_msgfds_num) {
g_free(s->write_msgfds);
s->write_msgfds = 0;
s->write_msgfds_num = 0;