URI: 
       close sockets/fds on disconnect and prevent fd leaks - teed - A multiplex relay tee(1) daemon.
  HTML git clone git://bitreich.org/teed git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/teed
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
   DIR LICENSE
       ---
   DIR commit c9671740957f58aa168262f3e76ad2f72542f05b
   DIR parent 22ed6e7883ecd3f6e3ade985a0963604ba800ade
  HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Mon, 14 Aug 2023 14:23:53 +0200
       
       close sockets/fds on disconnect and prevent fd leaks
       
       Signed-off-by: Christoph Lohmann <20h@r-36.net>
       
       Diffstat:
         M teed.c                              |       2 ++
       
       1 file changed, 2 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/teed.c b/teed.c
       @@ -265,6 +265,7 @@ main(int argc, char *argv[])
                                        recvl = read(*(int *)e->data, recvbuf,
                                                        sizeof(recvbuf));
                                        if (recvl <= 0) {
       +                                        close(*(int *)e->data);
                                                e = llist_del(&rfds, e);
                                                if (e == NULL)
                                                        break;
       @@ -275,6 +276,7 @@ main(int argc, char *argv[])
                                                sendl = recvl;
                                                while (sendl > 0) {
                                                        if ((sent = write(*(int *)qe->data, sendbufi, sendl)) < 0) {
       +                                                        close(*(int *)qe->data);
                                                                qe = llist_del(&wfds, qe);
                                                                break;
                                                        }