All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] io/channel-socket: Document why we can ignore socket_set_cork() errors
@ 2026-06-30  9:35 Peter Maydell
  2026-06-30  9:59 ` Daniel P. Berrangé
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2026-06-30  9:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniel P. Berrangé

In qio_channel_socket_set_cork(), we call socket_set_cork() but
ignore its success/failure return value.  This is OK because we are
implementing qio_channel_set_cork() here, and that function's API
documentation states that the setting is merely a hint.  So even if
setting TCP_CORK on the underlying socket fails for some reason, this
isn't going to be a problem for the caller; correspondingly the
qio_channel_set_cork() function has no error return.

Add a comment in qio_channel_socket_set_cork() explaining why we
don't check for errors.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/2254
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Spotted by a static analyzer; it seemed to me worth adding the comment.
---
 io/channel-socket.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/io/channel-socket.c b/io/channel-socket.c
index ea2ec84108..12773b832c 100644
--- a/io/channel-socket.c
+++ b/io/channel-socket.c
@@ -946,6 +946,12 @@ qio_channel_socket_set_cork(QIOChannel *ioc,
     QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(ioc);
     int v = enabled ? 1 : 0;
 
+    /*
+     * We can ignore the error return from socket_set_cork() because
+     * at the QIO API level set_cork is only a hint, and so
+     * qio_channel_set_cork() can never fail even if it didn't
+     * actually do anything.
+     */
     socket_set_cork(sioc->fd, v);
 }
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-30 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30  9:35 [PATCH] io/channel-socket: Document why we can ignore socket_set_cork() errors Peter Maydell
2026-06-30  9:59 ` Daniel P. Berrangé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.