summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-03-31 22:44:25 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-03-31 23:47:51 +0200
commitcf0234de47b019ac24e2d361d6386fdfad48f119 (patch)
treeca6aefb54e3ecfd2d76ba7495bcc2d83720ceb44 /libc
parent5fe8fc1ac4b5eb0f9e9bb01295c14b99d80ab41e (diff)
libc: Fix page-size in getifaddrs()
TODO: this could need a cleanup.. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc')
-rw-r--r--libc/inet/ifaddrs.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libc/inet/ifaddrs.c b/libc/inet/ifaddrs.c
index 6d9ee8903..0c9310651 100644
--- a/libc/inet/ifaddrs.c
+++ b/libc/inet/ifaddrs.c
@@ -115,7 +115,8 @@ __netlink_request (struct netlink_handle *h, int type)
{
struct netlink_res *nlm_next;
struct netlink_res **new_nlm_list;
- static volatile size_t buf_size = 4096;
+ static volatile size_t buf_size = 0;
+ size_t this_buf_size;
char *buf;
struct sockaddr_nl nladdr;
struct nlmsghdr *nlmh;
@@ -126,7 +127,15 @@ __netlink_request (struct netlink_handle *h, int type)
if (__netlink_sendreq (h, type) < 0)
return -1;
- size_t this_buf_size = buf_size;
+ if (buf_size)
+ this_buf_size = buf_size;
+ else {
+#ifdef PAGE_SIZE
+ this_buf_size = PAGE_SIZE;
+#else
+ this_buf_size = __pagesize;
+#endif
+ }
if (__libc_use_alloca (this_buf_size))
buf = alloca (this_buf_size);
else