ubase

suckless linux base utils
git clone git://git.2f30.org/ubase
Log | Files | Refs | README | LICENSE

apathmax.c (368B)


      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 	*p = emalloc(*size);
     22 }