X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ffailtest%2Ffailtest.c;fp=ccan%2Ffailtest%2Ffailtest.c;h=205ded254709e6611d67b4465ca3967744306252;hb=07dec048cb950abeb82c1447e523a2d22404b42a;hp=c61ce442a5d03b39444a87a468514f23c6f3c962;hpb=9e800830de8a9bbb9f103f120ea7de9220b6869d;p=ccan diff --git a/ccan/failtest/failtest.c b/ccan/failtest/failtest.c index c61ce442..205ded25 100644 --- a/ccan/failtest/failtest.c +++ b/ccan/failtest/failtest.c @@ -179,7 +179,8 @@ static struct failtest_call *add_history_(enum failtest_call_type type, call->line = line; call->cleanup = NULL; call->backtrace = get_backtrace(&call->backtrace_num); - memcpy(&call->u, elem, elem_size); + if (elem_size != 0) + memcpy(&call->u, elem, elem_size); tlist_add_tail(&history, call, list); return call; } @@ -1202,9 +1203,8 @@ static void cleanup_pipe(struct pipe_call *call, bool restore) int failtest_pipe(int pipefd[2], const char *file, unsigned line) { struct failtest_call *p; - struct pipe_call call; - p = add_history(FAILTEST_PIPE, true, file, line, &call); + p = add_history_(FAILTEST_PIPE, true, file, line, NULL, 0); if (should_fail(p)) { p->u.open.ret = -1; /* FIXME: Play with error codes? */