diff options
Diffstat (limited to 'libhw/w5500.c')
-rw-r--r-- | libhw/w5500.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libhw/w5500.c b/libhw/w5500.c index dfe169f..a8777db 100644 --- a/libhw/w5500.c +++ b/libhw/w5500.c @@ -589,8 +589,9 @@ static int w5500_tcplist_close(struct _w5500_socket *socket) { static ssize_t w5500_tcp_write(struct _w5500_socket *socket, void *buf, size_t count) { debugf("tcp_conn.write(%zu)", count); ASSERT_SELF(stream_conn, TCP); - assert(buf); - assert(count); + assert(count == 0 || buf); + if (count == 0) + return 0; /* What we really want is to pause until we receive an ACK for * some data we just queued, so that we can line up some new @@ -677,8 +678,9 @@ static void w5500_tcp_alarm_handler(void *_arg) { static ssize_t w5500_tcp_read(struct _w5500_socket *socket, void *buf, size_t count) { debugf("tcp_conn.read()"); ASSERT_SELF(stream_conn, TCP); - assert(buf); - assert(count); + assert(count == 0 || buf); + if (count == 0) + return 0; struct alarmclock_trigger trigger = {0}; if (socket->read_deadline_ns) |