Thanks Patrick. I should have guessed it was in input and and output. --Mike
On Wed, Feb 8, 2012 at 10:50 AM, Patrick Hunt [via zookeeper-user] < [email protected]> wrote: > Hi Mike, it looks like you are not initializing the "len" parameter. > > * \param buffer_len is the size of the buffer pointed to by the > buffer parameter. > * It'll be set to the actual data length upon return. If the data is > NULL, length is -1. > > Patrick > > On Tue, Feb 7, 2012 at 12:12 PM, mfthom <[hidden > email]<http://user/SendEmail.jtp?type=node&node=7266910&i=0>> > wrote: > > > I'm having trouble with a c client doing an asynchronous get. This > code: > > #include <zookeeper.h> > > #include <stdio.h> > > #include <pthread.h> > > #include <assert.h> > > char *Z = "/fuzz/targets/targ0000000002"; > > > > int main(int argc, char **argv) { > > static zhandle_t *zh = NULL; > > char ip[8192]; > > int len; > > struct Stat stat; > > printf("here here \n"); > > zh = zookeeper_init("172.20.110.100:2181", NULL, 30000, 0, 0, > 0); > > int rc = zoo_get(zh, Z, 0, ip, &len, &stat); > > if(rc != ZOK) > > { > > printf("crash\n"); > > }else{ > > printf("ip is %s len is %d\n", ip, len); > > } > > } > > > > will fail or work depending on the size of the ip array. 1024 works > > usually. 8292 fails. > > The failure symptom is that it returns a len of zero bytes instead of > the > > data (a simple IP address). > > > > And sometimes, zookeeper seg faults while doing memcpy. > > > > Thanks, > > --Mike > > > > -- > > View this message in context: > http://zookeeper-user.578899.n2.nabble.com/c-binding-asynchronous-get-problem-tp7263621p7263621.html > > Sent from the zookeeper-user mailing list archive at Nabble.com. > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://zookeeper-user.578899.n2.nabble.com/c-binding-asynchronous-get-problem-tp7263621p7266910.html > To unsubscribe from c binding asynchronous get problem, click > here<http://zookeeper-user.578899.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7263621&code=bWZ0aG9tQGdtYWlsLmNvbXw3MjYzNjIxfDcwMjI3MzMxMg==> > . > NAML<http://zookeeper-user.578899.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://zookeeper-user.578899.n2.nabble.com/c-binding-asynchronous-get-problem-tp7263621p7267384.html Sent from the zookeeper-user mailing list archive at Nabble.com.
