From 9fbcca048181b927cfcdb5c6c49e5bdff173aad5 Mon Sep 17 00:00:00 2001 From: HungMingWu Date: Tue, 13 Oct 2015 06:13:51 +0000 Subject: [PATCH] unix: fix uv__getiovmax return value On some embedded devices (arm-linux-uclibc based ip camera), sysconf(_SC_IOV_MAX) can not get the correct value. The return value is -1 and the errno is EINPROGRESS. Degrade the value to 1. PR-URL: https://github.com/libuv/libuv/pull/573 Reviewed-By: Ben Noordhuis --- src/unix/core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/unix/core.c b/src/unix/core.c index 48dbfd0a8..0db5f828c 100644 --- a/src/unix/core.c +++ b/src/unix/core.c @@ -204,8 +204,14 @@ int uv__getiovmax(void) { return IOV_MAX; #elif defined(_SC_IOV_MAX) static int iovmax = -1; - if (iovmax == -1) + if (iovmax == -1) { iovmax = sysconf(_SC_IOV_MAX); + /* On some embedded devices (arm-linux-uclibc based ip camera), + * sysconf(_SC_IOV_MAX) can not get the correct value. The return + * value is -1 and the errno is EINPROGRESS. Degrade the value to 1. + */ + if (iovmax == -1) iovmax = 1; + } return iovmax; #else return 1024;