summaryrefslogtreecommitdiffstats
path: root/avahi-client/client-test.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-08-16 01:29:28 +0000
committerLennart Poettering <lennart@poettering.net>2005-08-16 01:29:28 +0000
commitee4cc41fafaac0a2d76c1c791f6d43a6b6d937a7 (patch)
tree2fed674760fcb3031faac25e6bb5bd019cfad151 /avahi-client/client-test.c
parent91c63aa9b11519356a319d28a134fa3693da02a9 (diff)
* start implementing error handling in avahi-client
* doxygen document timeval.h * add two more AVAHI_GCC_SENTINELs git-svn-id: file:///home/lennart/svn/public/avahi/trunk@350 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-client/client-test.c')
-rw-r--r--avahi-client/client-test.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/avahi-client/client-test.c b/avahi-client/client-test.c
index 11bc4f2..f8f81af 100644
--- a/avahi-client/client-test.c
+++ b/avahi-client/client-test.c
@@ -87,12 +87,16 @@ main (int argc, char *argv[])
AvahiServiceTypeBrowser *st;
AvahiSimplePoll *simple_poll;
char *ret;
+ int error;
struct timeval tv;
simple_poll = avahi_simple_poll_new();
poll_api = avahi_simple_poll_get(simple_poll);
- avahi = avahi_client_new(poll_api, avahi_client_callback, "omghai2u");
+ if (!(avahi = avahi_client_new(poll_api, avahi_client_callback, "omghai2u", &error))) {
+ fprintf(stderr, "Client failed: %s\n", avahi_strerror(error));
+ goto fail;
+ }
assert (avahi != NULL);
@@ -155,10 +159,13 @@ main (int argc, char *argv[])
if (avahi_simple_poll_iterate(simple_poll, -1) != 0)
break;
+fail:
- avahi_simple_poll_free(simple_poll);
+ if (simple_poll)
+ avahi_simple_poll_free(simple_poll);
- avahi_free (avahi);
+ if (avahi)
+ avahi_free (avahi);
return 0;
}