lib/conf.c: don't stop after the first error and print error

This fixes void-linux/xbps#153.
This commit is contained in:
Duncan Overbruck 2019-08-05 15:26:55 +02:00
parent 72c207e0b5
commit e59ded73ae

View File

@ -225,7 +225,7 @@ parse_files_glob(struct xbps_handle *xhp, xbps_dictionary_t seen,
{ {
char tmppath[PATH_MAX]; char tmppath[PATH_MAX];
glob_t globbuf; glob_t globbuf;
int rs, rv = 0; int rs, rv = 0, rv2;
rs = snprintf(tmppath, PATH_MAX, "%s/%s", rs = snprintf(tmppath, PATH_MAX, "%s/%s",
pat[0] == '/' ? xhp->rootdir : cwd, pat); pat[0] == '/' ? xhp->rootdir : cwd, pat);
@ -247,8 +247,8 @@ parse_files_glob(struct xbps_handle *xhp, xbps_dictionary_t seen,
continue; continue;
xbps_dictionary_set_bool(seen, fname, true); xbps_dictionary_set_bool(seen, fname, true);
} }
if ((rv = parse_file(xhp, globbuf.gl_pathv[i], nested)) != 0) if ((rv2 = parse_file(xhp, globbuf.gl_pathv[i], nested)) != 0)
break; rv = rv2;
} }
globfree(&globbuf); globfree(&globbuf);
@ -268,7 +268,7 @@ parse_file(struct xbps_handle *xhp, const char *path, bool nested)
if ((fp = fopen(path, "r")) == NULL) { if ((fp = fopen(path, "r")) == NULL) {
rv = errno; rv = errno;
xbps_dbg_printf(xhp, "cannot read configuration file %s: %s\n", path, strerror(rv)); xbps_error_printf("cannot read configuration file %s: %s\n", path, strerror(rv));
return rv; return rv;
} }