On Thu, Jul 25, 2019 at 03:23:49AM +0000, Oleinik, Alexander wrote: > @@ -379,9 +399,18 @@ static void socket_sendf(int fd, const char *fmt, > va_list ap) > { > gchar *str = g_strdup_vprintf(fmt, ap); > size_t size = strlen(str); > +#ifdef CONFIG_FUZZ > + // Directly call qtest_process_inbuf in the qtest server > + GString *gstr = g_string_new_len(str, size); > + /* printf(">>> %s",gstr->str); */ > + qtest_server_recv(gstr); > + g_string_free(gstr, true); > + g_free(str); > +#else > > socket_send(fd, str, size); > g_free(str); > +#endif > }
This should use indirection: a function pointer to dispatch to either the socket or the internal qtest_process_inbuf() call. With a bit of refactoring you can eliminate the #ifdefs and treat the socket fd as one backend and direct invocation as another backend.
signature.asc
Description: PGP signature