On 10/18/21 23:30, Richard W.M. Jones wrote:
On Mon, Oct 18, 2021 at 10:12:49PM +0100, Richard W.M. Jones wrote:
On Mon, Oct 18, 2021 at 08:27:36PM +0200, Laszlo Ersek wrote:
On 10/15/21 16:17, Richard W.M. Jones wrote:
+#ifndef HAVE_CURLOPT_UNIX_SOCKET_PATH + fprintf (stderr, "%s: curl does not support CURLOPT_UNIX_SOCKET_PATH\n", + argv[0]); + exit (77); +#endif + + sockpath = web_server ("disk", NULL); + if (sockpath == NULL) { + fprintf (stderr, "%s: could not start web server thread\n", argv[0]); + exit (EXIT_FAILURE); + } + + /* Start nbdkit. */ + if (asprintf (&usp_param, "unix-socket-path=%s", sockpath) == -1) { + perror ("asprintf"); + exit (EXIT_FAILURE);
Is exit() safe here (with the web server running in another thread)?
I didn't know, but I temporarily modified the test changing #ifndef -> #ifdef above and it did exit (skip) fine.
Actually not a good test, because that happens before the web server launches. Inserting an exit later in the code works as expected.
Awesome, thanks. It's really thoughtful that web_server() "owns" the unix domain socket, i.e., that it takes responsibility for removing the pathname. Laszlo