From: Juho Vähä-Herttua Date: Tue, 9 Apr 2013 08:47:17 +0000 (+0300) Subject: Print error if dnssd library not available X-Git-Tag: upstream/0.9.0~4^2~34 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=61c2f5d5fa6f775ba9bee01788962cdae41c0b6c;p=deb_shairplay.git Print error if dnssd library not available --- diff --git a/src/shairplay.c b/src/shairplay.c index b125bbe..6ee23ba 100644 --- a/src/shairplay.c +++ b/src/shairplay.c @@ -233,6 +233,8 @@ main(int argc, char *argv[]) raop_t *raop; raop_callbacks_t raop_cbs; + int error; + memset(&options, 0, sizeof(options)); if (parse_options(&options, argc, argv)) { return 0; @@ -266,8 +268,20 @@ main(int argc, char *argv[]) raop_set_log_level(raop, RAOP_LOG_DEBUG); raop_start(raop, &options.port, hwaddr, sizeof(hwaddr), NULL); - dnssd = dnssd_init(NULL); + error = 0; + dnssd = dnssd_init(&error); + if (error) { + fprintf(stderr, "ERROR: Could not initialize dnssd library!\n"); + fprintf(stderr, "------------------------------------------\n"); + fprintf(stderr, "You could try the following resolutions based on your OS:\n"); + fprintf(stderr, "Windows: Try installing http://support.apple.com/kb/DL999\n"); + fprintf(stderr, "Debian/Ubuntu: Try installing libavahi-compat-libdnssd1 package\n"); + raop_destroy(raop); + return -1; + } + dnssd_register_raop(dnssd, options.apname, options.port, hwaddr, sizeof(hwaddr), 0); + dnssd_register_airplay(dnssd, options.apname, 1234, hwaddr, sizeof(hwaddr)); #ifndef WIN32 sleep(100);