diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-06-09 04:52:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-06-09 04:52:57 +0000 |
commit | 00151562145df50cc65e9902d52d5fa77f89fe50 (patch) | |
tree | 2737716802f6725a5074d606ec8fe5422c58a83c /spawn/spawn_server.c | |
parent | Releasing debian version 1.34.1-1. (diff) | |
download | netdata-00151562145df50cc65e9902d52d5fa77f89fe50.tar.xz netdata-00151562145df50cc65e9902d52d5fa77f89fe50.zip |
Merging upstream version 1.35.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'spawn/spawn_server.c')
-rw-r--r-- | spawn/spawn_server.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/spawn/spawn_server.c b/spawn/spawn_server.c index 57bcdf99a..53b143dea 100644 --- a/spawn/spawn_server.c +++ b/spawn/spawn_server.c @@ -71,12 +71,15 @@ static void after_pipe_write(uv_write_t *req, int status) #ifdef SPAWN_DEBUG fprintf(stderr, "SERVER %s called status=%d\n", __func__, status); #endif - freez(req->data); + void **data = req->data; + freez(data[0]); + freez(data[1]); + freez(data); } static void child_waited_async_cb(uv_async_t *async_handle) { - uv_buf_t writebuf[2]; + uv_buf_t *writebuf; int ret; struct spawn_execution_info *exec_info; struct write_context *write_ctx; @@ -84,8 +87,13 @@ static void child_waited_async_cb(uv_async_t *async_handle) (void)async_handle; while (NULL != (exec_info = dequeue_child_waited_list())) { write_ctx = mallocz(sizeof(*write_ctx)); - write_ctx->write_req.data = write_ctx; + void **data = callocz(2, sizeof(void *)); + writebuf = callocz(2, sizeof(uv_buf_t)); + + data[0] = write_ctx; + data[1] = writebuf; + write_ctx->write_req.data = data; write_ctx->header.opcode = SPAWN_PROT_CMD_EXIT_STATUS; write_ctx->header.handle = exec_info->handle; @@ -151,14 +159,18 @@ static void wait_children(void *arg) void spawn_protocol_execute_command(void *handle, char *command_to_run, uint16_t command_length) { - uv_buf_t writebuf[2]; + uv_buf_t *writebuf; int ret; avl_t *avl_ret; struct spawn_execution_info *exec_info; struct write_context *write_ctx; write_ctx = mallocz(sizeof(*write_ctx)); - write_ctx->write_req.data = write_ctx; + void **data = callocz(2, sizeof(void *)); + writebuf = callocz(2, sizeof(uv_buf_t)); + data[0] = write_ctx; + data[1] = writebuf; + write_ctx->write_req.data = data; command_to_run[command_length] = '\0'; #ifdef SPAWN_DEBUG @@ -300,8 +312,8 @@ void spawn_server(void) { int error; - test_clock_boottime(); - test_clock_monotonic_coarse(); + // initialize the system clocks + clocks_init(); // close all open file descriptors, except the standard ones // the caller may have left open files (lxc-attach has this issue) |