aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'config.c')
-rw-r--r--config.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/config.c b/config.c
index c249445..238a802 100644
--- a/config.c
+++ b/config.c
@@ -18,6 +18,7 @@ License: GPLv2
#include <unistd.h>
#include <dirent.h>
+#include <linux/limits.h>
#include <fnmatch.h>
#include "config.h"
@@ -181,7 +182,7 @@ void init_config(void)
static int find_all_configs(char* fn, int mustexist, CONFIG **first, CONFIG **last, GROUPS **firstg, GROUPS **lastg)
{
struct dirent **namelist;
- char dir[BUFSIZ], pattern[128], *p, s[BUFSIZ];
+ char dir[PATH_MAX - NAME_MAX - 1], pattern[128], *p, s[PATH_MAX];
int n, i, found;
/* Split fn to dir/pattern */
@@ -208,7 +209,7 @@ static int find_all_configs(char* fn, int mustexist, CONFIG **first, CONFIG **la
for (i = 0; i < n; i++) {
if (fnmatch(pattern, namelist[i]->d_name, 0) == 0 &&
fnmatch("*~", namelist[i]->d_name, 0) != 0) {
- snprintf(s, BUFSIZ, "%s/%s", dir, namelist[i]->d_name);
+ snprintf(s, PATH_MAX, "%s/%s", dir, namelist[i]->d_name);
read_one_config(s, first, last, firstg, lastg);
found++;
}