Logo Search packages:      
Sourcecode: libnl version File versions  Download package

int nlmsg_expand ( struct nl_msg *  n,
size_t  newlen 
)

Expand maximum payload size of a netlink message

  • n Netlink message.
  • newlen New maximum payload size.
Reallocates the payload section of a netlink message and increases the maximum payload size of the message.

Note:
Any pointers pointing to old payload block will be stale and need to be refetched. Therfore, do not expand while constructing nested attributes or while reserved data blocks are held.
Returns:
0 on success or a negative error code.

Definition at line 577 of file msg.c.

{
      void *tmp;

      if (newlen <= n->nm_size)
            return nl_errno(EINVAL);

      tmp = realloc(n->nm_nlh, newlen);
      if (tmp == NULL)
            return nl_errno(ENOMEM);

      n->nm_nlh = tmp;
      n->nm_size = newlen;

      return 0;
}


Generated by  Doxygen 1.6.0   Back to index