return strlen(s) >= l && strncmp(s, prefix, l) == 0;
}
-static int load_resolv_conf(const DaemonConfig *c) {
+static int load_resolv_conf(void) {
int ret = -1;
FILE *f;
int i = 0;
goto finish;
}
- resolv_conf = avahi_new0(char*, AVAHI_MAX_WIDE_AREA_SERVERS+1);
+ resolv_conf = avahi_new0(char*, AVAHI_WIDE_AREA_SERVERS_MAX+1);
- while (!feof(f) && i < AVAHI_MAX_WIDE_AREA_SERVERS) {
+ while (!feof(f) && i < AVAHI_WIDE_AREA_SERVERS_MAX) {
char ln[128];
char *p;
}
static void update_wide_area_servers(void) {
- AvahiAddress a[AVAHI_MAX_WIDE_AREA_SERVERS];
+ AvahiAddress a[AVAHI_WIDE_AREA_SERVERS_MAX];
unsigned n = 0;
char **p;
- for (p = resolv_conf; *p && n < AVAHI_MAX_WIDE_AREA_SERVERS; p++) {
+ for (p = resolv_conf; *p && n < AVAHI_WIDE_AREA_SERVERS_MAX; p++) {
if (!avahi_address_parse(*p, AVAHI_PROTO_UNSPEC, &a[n]))
avahi_log_warn("Failed to parse address '%s', ignoring.", *p);
else
avahi_server = s;
#ifdef HAVE_DBUS
- if (c->enable_dbus)
+ if (c->enable_dbus && state != AVAHI_SERVER_INVALID && state != AVAHI_SERVER_FAILURE)
dbus_protocol_server_state_changed(state);
#endif
daemon_log(log_level_map[level], "%s", txt);
}
-static void dump(const char *text, void* userdata) {
+static void dump(const char *text, AVAHI_GCC_UNUSED void* userdata) {
avahi_log_info("%s", text);
}
-static void signal_callback(AvahiWatch *watch, int fd, AvahiWatchEvent event, void *userdata) {
+static void signal_callback(AvahiWatch *watch, AVAHI_GCC_UNUSED int fd, AVAHI_GCC_UNUSED AvahiWatchEvent event, AVAHI_GCC_UNUSED void *userdata) {
int sig;
const AvahiPoll *poll_api;
if (resolv_conf_entry_group)
avahi_s_entry_group_reset(resolv_conf_entry_group);
- load_resolv_conf(&config);
+ load_resolv_conf();
update_wide_area_servers();
static int run_server(DaemonConfig *c) {
int r = -1;
int error;
- const AvahiPoll *poll_api;
- AvahiWatch *sig_watch;
+ const AvahiPoll *poll_api = NULL;
+ AvahiWatch *sig_watch = NULL;
assert(c);
#endif
}
- load_resolv_conf(c);
+ load_resolv_conf();
static_service_load();
if (!(avahi_server = avahi_server_new(poll_api, &c->server_config, server_callback, c, &error))) {
/** Parent **/
if ((ret = daemon_retval_wait(20)) < 0) {
- avahi_log_error("Could not recieve return value from daemon process.");
+ avahi_log_error("Could not receive return value from daemon process.");
goto finish;
}