MCPcopy Create free account
hub / github.com/ElementsProject/lightning / run_child

Function run_child

ccan/ccan/ptr_valid/ptr_valid.c:173–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173static void run_child(int infd, int outfd)
174{
175 volatile char *p;
176
177 /* This is how we expect to exit. */
178 while (read(infd, &p, sizeof(p)) == sizeof(p)) {
179 size_t i, size;
180 bool is_write;
181 char ret = 0;
182
183 /* This is weird. */
184 if (read(infd, &size, sizeof(size)) != sizeof(size))
185 exit(1);
186 if (read(infd, &is_write, sizeof(is_write)) != sizeof(is_write))
187 exit(2);
188
189 for (i = 0; i < size; i++) {
190 ret = p[i];
191 if (is_write)
192 p[i] = ret;
193 }
194
195 /* If we're still here, the answer is "yes". */
196 if (write(outfd, &ret, 1) != 1)
197 exit(3);
198 }
199 exit(0);
200}
201
202static bool create_child(struct ptr_valid_batch *batch)
203{

Callers 1

create_childFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected