1 #include <limits.h> 2 #include <stdlib.h> 3 4 static char *fifofile; 5 get_caps_fifo(void)6static const char *get_caps_fifo(void) 7 { 8 if (!fifofile) { 9 fifofile = getenv("FIFOFILE"); 10 11 if (!fifofile) { 12 const char *tmpdir = getenv("TMPDIR"); 13 14 if (!tmpdir) 15 tmpdir = "/tmp"; 16 fifofile = malloc(PATH_MAX); 17 snprintf(fifofile, PATH_MAX, "%s/caps_fifo", tmpdir); 18 } 19 } 20 21 return fifofile; 22 } 23