diff options
author | Amitay Isaacs <amitay@gmail.com> | 2017-07-27 01:35:20 +1000 |
---|---|---|
committer | Martin Schwenke <martins@samba.org> | 2017-08-30 14:59:26 +0200 |
commit | 933a0fa73c02545116d300c16d9f4a5b7edb445c (patch) | |
tree | 9354932386c48e6fd68e26fe14466bfb80cd4f02 | |
parent | 98715abef3cf2b4b6e074b00c03874f863b502e5 (diff) | |
download | samba-933a0fa73c02545116d300c16d9f4a5b7edb445c.tar.gz |
ctdb-protocol: Fix marshalling for ctdb_event_request_script_enable
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
-rw-r--r-- | ctdb/protocol/protocol_event.c | 13 | ||||
-rw-r--r-- | ctdb/tests/src/protocol_event_test.c | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/ctdb/protocol/protocol_event.c b/ctdb/protocol/protocol_event.c index d1cca15d352..9f1572d0047 100644 --- a/ctdb/protocol/protocol_event.c +++ b/ctdb/protocol/protocol_event.c @@ -373,17 +373,20 @@ static size_t ctdb_event_request_script_enable_len( static void ctdb_event_request_script_enable_push( struct ctdb_event_request_script_enable *in, - uint8_t *buf) + uint8_t *buf, size_t *npush) { size_t np; ctdb_stringn_push(&in->script_name, buf, &np); + + *npush = np; } static int ctdb_event_request_script_enable_pull( uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx, - struct ctdb_event_request_script_enable **out) + struct ctdb_event_request_script_enable **out, + size_t *npull) { struct ctdb_event_request_script_enable *rdata; size_t np; @@ -401,6 +404,7 @@ static int ctdb_event_request_script_enable_pull( } *out = rdata; + *npull = np; return 0; } @@ -499,7 +503,7 @@ static void ctdb_event_request_data_push(struct ctdb_event_request_data *in, case CTDB_EVENT_COMMAND_SCRIPT_ENABLE: ctdb_event_request_script_enable_push( in->data.script_enable, - buf+offset); + buf+offset, &np); break; case CTDB_EVENT_COMMAND_SCRIPT_DISABLE: @@ -546,7 +550,8 @@ static int ctdb_event_request_data_pull(uint8_t *buf, size_t buflen, ret = ctdb_event_request_script_enable_pull( buf+offset, buflen-offset, mem_ctx, - &out->data.script_enable); + &out->data.script_enable, + &np); break; case CTDB_EVENT_COMMAND_SCRIPT_DISABLE: diff --git a/ctdb/tests/src/protocol_event_test.c b/ctdb/tests/src/protocol_event_test.c index c91791cb649..f8c94e32e5d 100644 --- a/ctdb/tests/src/protocol_event_test.c +++ b/ctdb/tests/src/protocol_event_test.c @@ -264,7 +264,7 @@ static void test_ctdb_event_reply(void) PROTOCOL_TYPE3_TEST(struct ctdb_event_request_run, ctdb_event_request_run); PROTOCOL_TYPE3_TEST(struct ctdb_event_request_status, ctdb_event_request_status); -DEFINE_TEST(struct ctdb_event_request_script_enable, +PROTOCOL_TYPE3_TEST(struct ctdb_event_request_script_enable, ctdb_event_request_script_enable); DEFINE_TEST(struct ctdb_event_request_script_disable, ctdb_event_request_script_disable); |