- if (g->replace_wildcards)
- g->chosen_name = replacestr(g->name, "%h", avahi_server_get_host_name(avahi_server));
- else
+ if (g->replace_wildcards) {
+ char label[AVAHI_LABEL_MAX];
+ const char *p;
+
+ p = avahi_server_get_host_name(avahi_server);
+ avahi_unescape_label(&p, label, sizeof(label));
+
+ g->chosen_name = replacestr(g->name, "%h", label);
+ } else