sd-netlink: allocate read buffer when necessary
This commit is contained in:
@@ -255,7 +255,6 @@ int socket_read_message(sd_netlink *nl) {
|
||||
int r;
|
||||
|
||||
assert(nl);
|
||||
assert(nl->rbuffer);
|
||||
|
||||
/* read nothing, just get the pending message size */
|
||||
r = socket_recv_message(nl->fd, NULL, 0, NULL, true);
|
||||
|
||||
@@ -61,10 +61,6 @@ static int netlink_new(sd_netlink **ret) {
|
||||
.serial = (uint32_t) (now(CLOCK_MONOTONIC) % UINT32_MAX) + 1,
|
||||
};
|
||||
|
||||
/* We guarantee that the read buffer has at least space for a message header */
|
||||
if (!greedy_realloc((void**) &nl->rbuffer, sizeof(struct nlmsghdr), sizeof(uint8_t)))
|
||||
return -ENOMEM;
|
||||
|
||||
*ret = TAKE_PTR(nl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user