Re: sd_bus_message_read_array returns error -74

Naseer Kalyandrug <[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Message-ID <CAEnBoRA5he1oig93gUGx1rVno6N_EikXBkVprq35w9OAT6F3Gw@mail.gmail.com>
Hello Lennat , thanks for your email.

I did try readin the message type with sd_bus_message_peek_type and it
retired read message type =a hence it confirms that there an array of bytes
sitting there to be read

below is the snippet

  char *borrowed=NULL;
   size_t datasize=0;
   dbrc=sd_bus_message_read_array(m,SD_BUS_TYPE_BYTE,(const void
**)&borrowed,&datasize);



in your earlier reply i did not get you message " Note that
sd_bus_message_read_array() should be called *without*
entering the array container first."
appreciate if you could eloborate on this

On Fri, Nov 5, 2021 at 7:58 AM Lennart Poettering <[email protected]>
wrote:

> On Do, 04.11.21 22:04, Naseer Kalyandrug ([email protected]) wrote:
>
> > Hello
> >
> > I am trying to read array of bytes in using the sd_bus_message_read_array
> > by type 'y' , the sender also has the same format which send the array of
> > bytes as 'y'
> >
> > However i see the read_array is failing with erro no -74
> >
> > Can you please some help me in understanding the error and further
> triage .
>
> EBADMSG usually means that your message doesn't actually contain at
> the current read index what you try to read. You can use
> sd_bus_message_peek_type() to query what type should be read next.
>
> Note that sd_bus_message_read_array() should be called *without*
> entering the array container first.
>
> Lennart
>
> --
> Lennart Poettering, Berlin
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.