diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2019-06-14 23:19:12 +0200 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2019-06-14 23:19:12 +0200 |
commit | 2363d21cc073208b45a22b010a3da090cb1b77b0 (patch) | |
tree | d06261169e42570df593516ebe61927f057e48c4 /src/twister/twister_api.c | |
parent | b5399d0bafb8e4bd058d4278d506ebada632bb2d (diff) | |
download | twister-2363d21cc073208b45a22b010a3da090cb1b77b0.tar.gz twister-2363d21cc073208b45a22b010a3da090cb1b77b0.tar.bz2 twister-2363d21cc073208b45a22b010a3da090cb1b77b0.zip |
porting 'delete-path'
Diffstat (limited to 'src/twister/twister_api.c')
-rw-r--r-- | src/twister/twister_api.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/twister/twister_api.c b/src/twister/twister_api.c index 978e7d1..4beaff5 100644 --- a/src/twister/twister_api.c +++ b/src/twister/twister_api.c @@ -33,7 +33,6 @@ GNUNET_log_from (kind, "twister-api",__VA_ARGS__) - /** * Opaque handle for asynchronous operation. */ @@ -422,6 +421,7 @@ TALER_TWISTER_delete_path struct TALER_TWISTER_Operation *op; struct GNUNET_MQ_Envelope *env; struct TWISTER_DeletePath *src; //FIXME 'src' right name? + uint16_t stralloc; op = GNUNET_new (struct TALER_TWISTER_Operation); op->h = h; @@ -430,12 +430,20 @@ TALER_TWISTER_delete_path GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); - /* Prepare *env*elope. */ - env = GNUNET_MQ_msg - (src, TWISTER_MESSAGE_TYPE_DELETE_PATH); - /* Put data into the envelope. */ - strcpy (src->path, path); - /* Send message. */ + + stralloc = strlen (path) + 1; + + + GNUNET_assert + (stralloc + sizeof (struct TWISTER_DeletePath) < UINT16_MAX); + env = GNUNET_MQ_msg_extra (src, + stralloc, + TWISTER_MESSAGE_TYPE_DELETE_PATH); + GNUNET_assert + (stralloc == GNUNET_STRINGS_buffer_fill ((char *) &src[1], + stralloc, + 1, + path)); GNUNET_MQ_send (h->mq, env); return op; } @@ -470,7 +478,6 @@ TALER_TWISTER_modify_path_dl (struct TALER_TWISTER_Handle *h, GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); - /* Prepare *env*elope. */ env = GNUNET_MQ_msg (src, TWISTER_MESSAGE_TYPE_MODIFY_PATH_DL); /* Put data into the envelope. */ |