diff options
| author | Nakidai <nakidai@disroot.org> | 2025-05-11 19:28:38 +0300 |
|---|---|---|
| committer | Nakidai <nakidai@disroot.org> | 2025-05-11 19:28:38 +0300 |
| commit | ae5bd54066fc78455eb0e53956ec4c10ad0e03b9 (patch) | |
| tree | d8a593af7005f2fb065cf6736803ca3ce7ebeda8 | |
| parent | 337ee19afd48f271ec604ae0c442cbe8f3884d03 (diff) | |
| download | ttb-ae5bd54066fc78455eb0e53956ec4c10ad0e03b9.tar.gz ttb-ae5bd54066fc78455eb0e53956ec4c10ad0e03b9.zip | |
Add check for EINTR on braoadcast writing
When signal occures, write can return with EINTR and shouls be recalled then see: signal(7)
| -rw-r--r-- | ttb.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ttb.c b/ttb.c index 48e73c5..8f0c561 100644 --- a/ttb.c +++ b/ttb.c @@ -1,3 +1,4 @@ +#include <errno.h> #include <signal.h> #include <stddef.h> #include <stdio.h> @@ -103,7 +104,7 @@ after: for (size_t j = 1; j < lengthof(peers); ++j) if (peers[j] && i != j) - write(peers[j], buf, reads); + while (errno = 0, write(peers[j], buf, reads), errno == EINTR); } } } |