diff --git a/src/libostree/ostree-repo-finder-avahi.c b/src/libostree/ostree-repo-finder-avahi.c index 514351fc..1e77a6e0 100644 --- a/src/libostree/ostree-repo-finder-avahi.c +++ b/src/libostree/ostree-repo-finder-avahi.c @@ -1437,9 +1437,15 @@ ostree_repo_finder_avahi_start (OstreeRepoFinderAvahi *self, if (client == NULL) { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "Failed to create finder client: %s", - avahi_strerror (failure)); + if (failure == AVAHI_ERR_NO_DAEMON) + g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, + "Avahi daemon is not running: %s", + avahi_strerror (failure)); + else + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Failed to create finder client: %s", + avahi_strerror (failure)); + return; } diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index be7cb228..f5745f86 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -4686,7 +4686,20 @@ ostree_repo_find_remotes_async (OstreeRepo *self, if (local_error != NULL) { - g_warning ("Avahi finder failed; removing it: %s", local_error->message); + /* See ostree-repo-finder-avahi.c:ostree_repo_finder_avahi_start, we + * intentionally throw this so as to distinguish between the Avahi + * finder failing because the Avahi daemon wasn't running and + * the Avahi finder failing because of some actual error. + * + * We need to distinguish between g_debug and g_warning here because + * unit tests that use this code may set G_DEBUG=fatal-warnings which + * would cause client code to abort if a warning were emitted. + */ + if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) + g_debug ("Avahi finder failed under normal operation; removing it: %s", local_error->message); + else + g_warning ("Avahi finder failed abnormally; removing it: %s", local_error->message); + default_finders[2] = NULL; g_clear_object (&finder_avahi); }