Revision f1ef5555
b/qemu-nbd.c | ||
---|---|---|
205 | 205 |
do { |
206 | 206 |
sock = unix_socket_outgoing(sockpath); |
207 | 207 |
if (sock == -1) { |
208 |
if (errno != ENOENT && errno != ECONNREFUSED) { |
|
209 |
goto out; |
|
210 |
} |
|
211 |
sleep(1); /* wait parent */ |
|
208 |
goto out; |
|
212 | 209 |
} |
213 | 210 |
} while (sock == -1); |
214 | 211 |
|
... | ... | |
480 | 477 |
err(EXIT_FAILURE, "Could not find partition %d", partition); |
481 | 478 |
|
482 | 479 |
if (device) { |
483 |
int ret; |
|
484 |
|
|
485 | 480 |
/* Open before spawning new threads. In the future, we may |
486 | 481 |
* drop privileges after opening. |
487 | 482 |
*/ |
... | ... | |
494 | 489 |
sockpath = g_malloc(128); |
495 | 490 |
snprintf(sockpath, 128, SOCKET_PATH, basename(device)); |
496 | 491 |
} |
497 |
|
|
498 |
ret = pthread_create(&client_thread, NULL, nbd_client_thread, &fd); |
|
499 |
if (ret != 0) { |
|
500 |
errx(EXIT_FAILURE, "Failed to create client thread: %s", |
|
501 |
strerror(ret)); |
|
502 |
} |
|
503 |
} else { |
|
504 |
/* Shut up GCC warnings. */ |
|
505 |
memset(&client_thread, 0, sizeof(client_thread)); |
|
506 | 492 |
} |
507 | 493 |
|
508 | 494 |
sharing_fds = g_malloc((shared + 1) * sizeof(int)); |
... | ... | |
515 | 501 |
|
516 | 502 |
if (sharing_fds[0] == -1) |
517 | 503 |
return 1; |
504 |
|
|
505 |
if (device) { |
|
506 |
int ret; |
|
507 |
|
|
508 |
ret = pthread_create(&client_thread, NULL, nbd_client_thread, &fd); |
|
509 |
if (ret != 0) { |
|
510 |
errx(EXIT_FAILURE, "Failed to create client thread: %s", |
|
511 |
strerror(ret)); |
|
512 |
} |
|
513 |
} else { |
|
514 |
/* Shut up GCC warnings. */ |
|
515 |
memset(&client_thread, 0, sizeof(client_thread)); |
|
516 |
} |
|
517 |
|
|
518 | 518 |
max_fd = sharing_fds[0]; |
519 | 519 |
nb_fds++; |
520 | 520 |
|
Also available in: Unified diff