morpheus-base

morpheus base system
git clone git://git.2f30.org/morpheus-base
Log | Files | Refs

apathmax.c (366B)


      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)) < 0) {
     15 		if (errno == 0) {
     16 			*size = BUFSIZ;
     17 		} else {
     18 			eprintf("pathconf:");
     19 		}
     20 	}
     21 	*p = emalloc(*size);
     22 }