From: Quanah Gibson-Mount Date: Fri, 22 Sep 2017 19:05:18 +0000 (-0700) Subject: Fix additional compile for /dev/poll support. /dev/poll is neither tested nor supported. X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=04cfd144d9f31b6e1f3d9d85b6fdd932ef18a153;p=openldap Fix additional compile for /dev/poll support. /dev/poll is neither tested nor supported. --- diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 6542a4c5e1..1464302c6d 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -407,7 +407,7 @@ static slap_daemon_st slap_daemon[SLAPD_MAX_DAEMON_THREADS]; SLAP_DEVPOLL_SOCK_LX(t,(s)) = (l); \ SLAP_DEVPOLL_SOCK_FD(t,(s)) = (s); \ SLAP_DEVPOLL_SOCK_EV(t,(s)) = POLLIN; \ - SLAP_DEVPOLL_WRITE_POLLFD(t,(s), &SLAP_DEVPOLL_SOCK_EP((s)), 1, "ADD", 1); \ + SLAP_DEVPOLL_WRITE_POLLFD(t,(s), &SLAP_DEVPOLL_SOCK_EP(t, (s)), 1, "ADD", 1); \ slap_daemon[t].sd_nfds++; \ } while (0) @@ -443,6 +443,16 @@ static slap_daemon_st slap_daemon[SLAPD_MAX_DAEMON_THREADS]; # define SLAP_EVENT_IS_LISTENER(t,i) SLAP_DEVPOLL_EV_LISTENER(SLAP_DEVPOLL_SOCK_LX(t, SLAP_EVENT_FD(t,(i)))) # define SLAP_EVENT_LISTENER(t,i) SLAP_DEVPOLL_SOCK_LX(t, SLAP_EVENT_FD(t,(i))) +# define SLAP_SOCK_DESTROY(t) do { \ + if ( slap_daemon[t].sd_pollfd != NULL ) { \ + ch_free( slap_daemon[t].sd_pollfd ); \ + slap_daemon[t].sd_pollfd = NULL; \ + slap_daemon[t].sd_index = NULL; \ + slap_daemon[t].sd_l = NULL; \ + close( slap_daemon[t].sd_dpfd ); \ + } \ +} while ( 0 ) + # define SLAP_SOCK_INIT(t) do { \ slap_daemon[t].sd_pollfd = ch_calloc( 1, \ ( sizeof(struct pollfd) * 2 \ @@ -455,7 +465,7 @@ static slap_daemon_st slap_daemon[SLAPD_MAX_DAEMON_THREADS]; Debug( LDAP_DEBUG_ANY, "daemon: " SLAP_EVENT_FNAME ": " \ "open(\"" SLAP_EVENT_FNAME "\") failed errno=%d\n", \ errno, 0, 0 ); \ - SLAP_SOCK_DESTROY; \ + SLAP_SOCK_DESTROY(t); \ return -1; \ } \ for ( i = 0; i < dtblsize; i++ ) { \ @@ -464,16 +474,6 @@ static slap_daemon_st slap_daemon[SLAPD_MAX_DAEMON_THREADS]; } \ } while (0) -# define SLAP_SOCK_DESTROY(t) do { \ - if ( slap_daemon[t].sd_pollfd != NULL ) { \ - ch_free( slap_daemon[t].sd_pollfd ); \ - slap_daemon[t].sd_pollfd = NULL; \ - slap_daemon[t].sd_index = NULL; \ - slap_daemon[t].sd_l = NULL; \ - close( slap_daemon[t].sd_dpfd ); \ - } \ -} while ( 0 ) - # define SLAP_EVENT_DECL struct pollfd *revents # define SLAP_EVENT_INIT(t) do { \