diff options
author | Mikhail Burakov <mburakov@mailbox.org> | 2023-03-18 18:17:05 +0100 |
---|---|---|
committer | Mikhail Burakov <mburakov@mailbox.org> | 2023-03-18 18:17:05 +0100 |
commit | 85c81156a37e161ca08831b9ac9af022c72ebdea (patch) | |
tree | 03d89e6dee123445f42f14e51272f7bd493b0eeb | |
parent | 05a8dd31625ce342e3255cb980d5fac0017e91da (diff) |
Proper handling of clients closing their stdin
-rw-r--r-- | encode.c | 1 | ||||
-rw-r--r-- | main.c | 1 |
2 files changed, 2 insertions, 0 deletions
@@ -206,6 +206,7 @@ static bool DrainPacket(const struct AVPacket* packet, int fd) { switch (result) { case -1: if (errno == EINTR) continue; + if (errno == EPIPE) return true; LOG("Failed to write packed (%s)", strerror(errno)); return false; case 0: @@ -63,6 +63,7 @@ int main(int argc, char* argv[]) { (void)argv; if (signal(SIGINT, OnSignal) == SIG_ERR || + signal(SIGPIPE, OnSignal) == SIG_ERR || signal(SIGTERM, OnSignal) == SIG_ERR) { LOG("Failed to set signal handlers (%s)", strerror(errno)); return EXIT_FAILURE; |