diff options
Diffstat (limited to 'qemu-nbd.c')
-rw-r--r-- | qemu-nbd.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/qemu-nbd.c b/qemu-nbd.c index d2657b8db5..33476a1000 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -155,12 +155,13 @@ QEMU_COPYRIGHT "\n" , name); } +#if HAVE_NBD_DEVICE static void termsig_handler(int signum) { atomic_cmpxchg(&state, RUNNING, TERMINATE); qemu_notify_event(); } - +#endif /* HAVE_NBD_DEVICE */ static int qemu_nbd_client_list(SocketAddress *saddr, QCryptoTLSCreds *tls, const char *hostname) @@ -587,6 +588,7 @@ int main(int argc, char **argv) unsigned socket_activation; const char *pid_file_name = NULL; +#if HAVE_NBD_DEVICE /* The client thread uses SIGTERM to interrupt the server. A signal * handler ensures that "qemu-nbd -v -c" exits with a nice status code. */ @@ -594,11 +596,13 @@ int main(int argc, char **argv) memset(&sa_sigterm, 0, sizeof(sa_sigterm)); sa_sigterm.sa_handler = termsig_handler; sigaction(SIGTERM, &sa_sigterm, NULL); +#endif /* HAVE_NBD_DEVICE */ #ifdef CONFIG_POSIX signal(SIGPIPE, SIG_IGN); #endif + socket_init(); error_init(argv[0]); module_call_init(MODULE_INIT_TRACE); qcrypto_init(&error_fatal); @@ -895,6 +899,7 @@ int main(int argc, char **argv) #endif if ((device && !verbose) || fork_process) { +#ifndef WIN32 int stderr_fd[2]; pid_t pid; int ret; @@ -958,6 +963,10 @@ int main(int argc, char **argv) */ exit(errors); } +#else /* WIN32 */ + error_report("Unable to fork into background on Windows hosts"); + exit(EXIT_FAILURE); +#endif /* WIN32 */ } if (device != NULL && sockpath == NULL) { |