master xplshn/aruu / shared / libutil / apathmax.c
 1/* See LICENSE file for copyright and license details. */
 2#include <errno.h>
 3#include <stdio.h>
 4#include <stdlib.h>
 5#include <unistd.h>
 6
 7#include "../util.h"
 8
 9void
10apathmax(char **p, long *size)
11{
12	errno = 0;
13
14	if ((*size = pathconf("/", _PC_PATH_MAX)) == -1) {
15		if (errno == 0) {
16			*size = BUFSIZ;
17		} else {
18			eprintf("pathconf:");
19		}
20	}
21	*p = emalloc(*size);
22}