long maxlen = path_max(path);
ssize_t len;
char *buf;
-#ifdef PATH_MAX
- maxlen = PATH_MAX;
-#elif defined(MAXPATHLEN)
- maxlen = MAXPATHLEN;
-#elif defined(_PC_PATH_MAX)
- maxlen = pathconf(path, _PC_PATH_MAX);
-#endif
- if (maxlen < 4096) maxlen = 4096;
buf = x_malloc(maxlen);
len = readlink(path, buf, maxlen-1);
}
allocated = size_hint;
*data = x_malloc(allocated);
- ret = 0;
while (true) {
if (pos > allocated / 2) {
allocated *= 2;