ubase/util/apathmax.c

23 lines
368 B
C
Raw Normal View History

2013-08-14 10:38:43 -04:00
/* See LICENSE file for copyright and license details. */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "../util.h"
void
apathmax(char **p, long *size)
{
errno = 0;
2014-07-09 11:39:32 -04:00
if ((*size = pathconf("/", _PC_PATH_MAX)) == -1) {
if (errno == 0) {
2013-08-14 10:38:43 -04:00
*size = BUFSIZ;
} else {
eprintf("pathconf:");
}
}
*p = emalloc(*size);
2013-08-14 10:38:43 -04:00
}