confile: cleanup do_includedir()

parent 59c2e311
...@@ -2362,16 +2362,15 @@ static int do_includedir(const char *dirp, struct lxc_conf *lxc_conf) ...@@ -2362,16 +2362,15 @@ static int do_includedir(const char *dirp, struct lxc_conf *lxc_conf)
{ {
__do_closedir DIR *dir = NULL; __do_closedir DIR *dir = NULL;
struct dirent *direntp; struct dirent *direntp;
char path[PATH_MAX]; int len, ret;
int len;
int ret = -1;
dir = opendir(dirp); dir = opendir(dirp);
if (!dir) if (!dir)
return -1; return -errno;
while ((direntp = readdir(dir))) { while ((direntp = readdir(dir))) {
const char *fnam; const char *fnam;
char path[PATH_MAX];
fnam = direntp->d_name; fnam = direntp->d_name;
if (!strcmp(fnam, ".")) if (!strcmp(fnam, "."))
...@@ -2386,11 +2385,11 @@ static int do_includedir(const char *dirp, struct lxc_conf *lxc_conf) ...@@ -2386,11 +2385,11 @@ static int do_includedir(const char *dirp, struct lxc_conf *lxc_conf)
len = snprintf(path, PATH_MAX, "%s/%s", dirp, fnam); len = snprintf(path, PATH_MAX, "%s/%s", dirp, fnam);
if (len < 0 || len >= PATH_MAX) if (len < 0 || len >= PATH_MAX)
return -1; return ret_errno(EIO);
ret = lxc_config_read(path, lxc_conf, true); ret = lxc_config_read(path, lxc_conf, true);
if (ret < 0) if (ret < 0)
return -1; return ret;
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment