| 39 | |
| 40 | |
| 41 | static inline char *alloc_sysconf_buffer(int name, size_t *retlen) |
| 42 | { |
| 43 | long buflen = sysconf(name); |
| 44 | if (buflen == -1) |
| 45 | { |
| 46 | // Some Linux distributions/libc libraries may fail to lookup the |
| 47 | // the proper sysconf() value. Fallback to a reasonable size most |
| 48 | // likely large enough. This is a known issue with Alpine Linux. |
| 49 | buflen = 16384; |
| 50 | } |
| 51 | *retlen = buflen; |
| 52 | char *retbuf = (char *)malloc((size_t)buflen); |
| 53 | memset(retbuf, 0, buflen); |
| 54 | return retbuf; |
| 55 | } |
| 56 | |
| 57 | |
| 58 | /** |
no outgoing calls
no test coverage detected