Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnssd.c: Let Avahi decide the hostname for register #902

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cups/dnssd.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,11 @@ cupsDNSSDNew(
#else // HAVE_AVAHI
int error; // Error code

// Avahi client callback is first run when client is created.
// Ignore the initial call to prevent regenerating hostnames
// and registrations for nothing...
dnssd->config_changes = -1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config_changes is size_t so you can't assign it a negative value...


if ((dnssd->poll = avahi_simple_poll_new()) == NULL)
{
// Unable to create the background thread...
Expand Down Expand Up @@ -1096,7 +1101,7 @@ cupsDNSSDServiceAdd(
*subtypes++ = '\0';

// Add the service entry...
if ((error = avahi_entry_group_add_service_strlst(service->group, avahi_if_index(service->if_index), AVAHI_PROTO_UNSPEC, /*flags*/0, service->name, regtype, domain, host, port, txtrec)) < 0)
if ((error = avahi_entry_group_add_service_strlst(service->group, avahi_if_index(service->if_index), AVAHI_PROTO_UNSPEC, /*flags*/0, service->name, regtype, domain, NULL, port, txtrec)) < 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This really needs to be "host" unless it is "localhost"...

{
report_error(service->dnssd, "Unable to register '%s.%s': %s", service->name, regtype, avahi_strerror(error));
ret = false;
Expand Down
Loading