Skip to content

Commit

Permalink
This commit incorporates @janicez' interpretation of the fix suggeste…
Browse files Browse the repository at this point in the history
…d by amdj on charybdis-ircd/charybdis#291 for what I am calling the 'bandb bug'.

per @aaronmdjones, "I'd hazard a guess that O_CLOEXEC isn't being set somewhere (or isn't being respected, if it is). I'll have a look into this, but without a system to test and reproduce on, I can't promise anything."
  • Loading branch information
janicez committed Oct 12, 2019
1 parent a6ef83a commit c723b9b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "hash.h"
#include "s_assert.h"
#include "logger.h"
#include "fcntl.h"

#ifndef INADDR_NONE
#define INADDR_NONE ((unsigned int) 0xffffffff)
Expand Down Expand Up @@ -271,6 +272,8 @@ inetport(struct Listener *listener)

listener->F = F;

// Added as workaround for 'bandb listen' (charybdis-ircd/charybdis#291) bug by ellenor - let's see if it works
fcntl (rb_get_fd(listener->F), F_SETFD, fcntl(rb_get_fd(listener->F), F_GETFD, 0) | FD_CLOEXEC);
rb_accept_tcp(listener->F, accept_precallback, accept_callback, listener);
return 1;
}
Expand Down Expand Up @@ -382,6 +385,9 @@ inetport_sctp(struct Listener *listener)

listener->F = F;

// Added as workaround for 'bandb listen' (charybdis-ircd/charybdis#291) bug by ellenor - let's see if it works
// Not applicable to mainline Charybdis 3.5.7 because this is for SCTP, not TCP, but the bug still occurs.
fcntl (rb_get_fd(listener->F), F_SETFD, fcntl(rb_get_fd(listener->F), F_GETFD, 0) | FD_CLOEXEC);
rb_accept_tcp(listener->F, accept_precallback, accept_callback, listener);
return 1;
#endif
Expand Down

0 comments on commit c723b9b

Please sign in to comment.