Skip to content

Commit

Permalink
Clean up mDNSResponder support.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Apr 21, 2024
1 parent b42093f commit bfb1339
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion cups/dnssd.c
Expand Up @@ -1685,12 +1685,26 @@ mdns_browse_cb(
const char *domain, // I - Domain
cups_dnssd_browse_t *browse) // I - Browse request
{
char temp[256], // Temporary string
*tempptr; // Pointer into temporary string


(void)ref;

if (error != kDNSServiceErr_NoError)
report_error(browse->dnssd, "DNS-SD browse error: %s", mdns_strerror(error));

(browse->cb)(browse, browse->cb_data, mdns_to_cups(flags, error), if_index, name, regtype, domain);
// Strip trailing dot from registration/service type...
cupsCopyString(temp, regtype, sizeof(temp));
if ((tempptr = temp + strlen(temp) - 1) >= temp && *tempptr == '.')
*tempptr = '\0';

// Strip leading dot from domain...
if (domain && *domain == '.')
domain ++; // Eliminate leading period

// Call the browse callback...
(browse->cb)(browse, browse->cb_data, mdns_to_cups(flags, error), if_index, name, temp, domain);
}


Expand Down
2 changes: 1 addition & 1 deletion cups/testdnssd.c
Expand Up @@ -318,7 +318,7 @@ browse_print_cb(
// Test data


printf("%5u %s.%s%s\n", if_index, name, regtype, domain);
printf("%5u %s.%s.%s\n", if_index, name, regtype, domain);

cupsMutexLock(&data->mutex);
data->browse_dnssd_count ++;
Expand Down

0 comments on commit bfb1339

Please sign in to comment.