From 23967592915de0aa79b33e1bdf62b2165b51e1df Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Fri, 21 Jan 2011 11:23:00 +0000 Subject: [PATCH] ITS#6758 Support rs_reinit(rs, rs->sr_type). rs_reinit() looks like a function call, so it should act like one. --- servers/slapd/proto-slap.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 1580876109..35b0fa1ed1 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -1557,8 +1557,11 @@ LDAP_SLAPD_F (void) (rs_assert_done) LDAP_P(( const SlapReply *rs )); #define rs_reinit(rs, type) do { \ SlapReply *const rsRI = (rs); \ rs_assert_done( rsRI ); \ - memset( rsRI, 0, sizeof(*rsRI) ); \ rsRI->sr_type = (type); \ + /* Got type before memset in case of rs_reinit(rs, rs->sr_type) */ \ + assert( !offsetof( SlapReply, sr_type ) ); \ + memset( (slap_reply_t *) rsRI + 1, 0, \ + sizeof(*rsRI) - sizeof(slap_reply_t) ); \ } while ( 0 ) LDAP_SLAPD_F (void) (rs_reinit) LDAP_P(( SlapReply *rs, slap_reply_t type )); LDAP_SLAPD_F (void) rs_flush_entry LDAP_P(( Operation *op, -- 2.39.5