]> granicus.if.org Git - libevent/commitdiff
Be nice and "handle" error return values in sample code
authorSebastian Hahn <sebastian@torproject.org>
Mon, 11 Apr 2011 16:03:02 +0000 (18:03 +0200)
committerSebastian Hahn <sebastian@torproject.org>
Sat, 23 Apr 2011 00:04:58 +0000 (02:04 +0200)
Caught by clang's static analyzer

sample/dns-example.c

index 439a486ac19e76c0c85ce31756462b3f7d2a788e..2845cb993169bff631cbdcbf5d61c47247ed4c5d 100644 (file)
@@ -120,6 +120,8 @@ evdns_server_callback(struct evdns_server_request *req, void *data)
                        printf(" -- replying for %s (PTR)\n", req->questions[i]->name);
                        r = evdns_server_request_add_ptr_reply(req, NULL, req->questions[i]->name,
                                                                                        "foo.bar.example.com", 10);
+                       if (r<0)
+                               printf("ugh, no luck");
                } else {
                        printf(" -- skipping %s [%d %d]\n", req->questions[i]->name,
                                   req->questions[i]->type, req->questions[i]->dns_question_class);