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:");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-30 08:08:16 -04:00
|
|
|
*p = emalloc(*size);
|
2013-08-14 10:38:43 -04:00
|
|
|
}
|