summaryrefslogtreecommitdiff
path: root/ctdb/protocol/protocol_basic.c
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2017-06-29 22:18:27 +1000
committerMartin Schwenke <martins@samba.org>2017-08-30 14:59:22 +0200
commite0cb2f7b83e6703ecb34cdbb198e8b1a467f7287 (patch)
treee038f0de2d2cbe26155de1ba30a1271e8593ee4e /ctdb/protocol/protocol_basic.c
parent1d6840982b70cac7dca9c440af7f464f9244a5f6 (diff)
downloadsamba-e0cb2f7b83e6703ecb34cdbb198e8b1a467f7287.tar.gz
ctdb-protocol: Fix marshalling for pid_t
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'ctdb/protocol/protocol_basic.c')
-rw-r--r--ctdb/protocol/protocol_basic.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ctdb/protocol/protocol_basic.c b/ctdb/protocol/protocol_basic.c
index 10824cf4ed7..689d7decb6e 100644
--- a/ctdb/protocol/protocol_basic.c
+++ b/ctdb/protocol/protocol_basic.c
@@ -323,23 +323,24 @@ int ctdb_stringn_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
* System defined data types
*/
-size_t ctdb_pid_len(pid_t pid)
+size_t ctdb_pid_len(pid_t *in)
{
return sizeof(pid_t);
}
-void ctdb_pid_push(pid_t pid, uint8_t *buf)
+void ctdb_pid_push(pid_t *in, uint8_t *buf, size_t *npush)
{
- memcpy(buf, &pid, sizeof(pid_t));
+ memcpy(buf, in, sizeof(pid_t));
+ *npush = sizeof(pid_t);
}
-int ctdb_pid_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,
- pid_t *out)
+int ctdb_pid_pull(uint8_t *buf, size_t buflen, pid_t *out, size_t *npull)
{
if (buflen < sizeof(pid_t)) {
return EMSGSIZE;
}
- *out = *(pid_t *)buf;
+ memcpy(out, buf, sizeof(pid_t));
+ *npull = sizeof(pid_t);
return 0;
}