X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=libopkg%2Fopkg_conf.c;h=d0d0329c14330a7e1f3f9c8bb7db544ced2c4ae7;hb=743aa6642e39c5f20a79e675ee509941da0f728a;hp=d773c16828e3dfaa6064e78cd0203d0caa262f76;hpb=e19ce4d44b10a45f84e9c994ba3ddc81698a2cd9;p=oweals%2Fopkg-lede.git diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c index d773c16..d0d0329 100644 --- a/libopkg/opkg_conf.c +++ b/libopkg/opkg_conf.c @@ -34,7 +34,7 @@ #include static int lock_fd; -char *lock_file; +static char *lock_file = NULL; static opkg_conf_t _conf; opkg_conf_t *conf = &_conf; @@ -392,13 +392,23 @@ root_filename_alloc(char *filename) return root_filename; } +static int +glob_errfunc(const char *epath, int eerrno) +{ + if (eerrno == ENOENT) + /* If leading dir does not exist, we get GLOB_NOMATCH. */ + return 0; + + opkg_msg(ERROR, "glob failed for %s: %s\n", epath, strerror(eerrno)); + return 0; +} + int opkg_conf_init(void) { - int i; + int i, glob_ret; char *tmp, *tmp_dir_base, **tmp_val; nv_pair_list_t tmp_dest_nv_pair_list; - char *lock_file = NULL; glob_t globbuf; char *etc_opkg_conf_pattern; @@ -437,7 +447,8 @@ opkg_conf_init(void) } memset(&globbuf, 0, sizeof(globbuf)); - if (glob(etc_opkg_conf_pattern, 0, NULL, &globbuf)) { + glob_ret = glob(etc_opkg_conf_pattern, 0, glob_errfunc, &globbuf); + if (glob_ret && glob_ret != GLOB_NOMATCH) { free(etc_opkg_conf_pattern); globfree(&globbuf); goto err1;