apathmax.c - smdev - suckless mdev | |
git clone git://git.suckless.org/smdev | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
apathmax.c (395B) | |
--- | |
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 | |
9 void | |
10 apathmax(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 | |
22 if(!(*p = malloc(*size))) | |
23 eprintf("malloc:"); | |
24 } | |
25 |