diff options
author | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-12-17 18:26:31 (EST) |
---|---|---|
committer | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-12-17 18:26:31 (EST) |
commit | 1bc689832bccbf7d799a96c185793d6023a4206e (patch) | |
tree | 8605a853fb4dd394cb7cebfb1a54d0deba5f3935 | |
parent | 3f2c4682812060e659b5cc087afa7750e9f67e49 (diff) |
Allow GLOB_NOMATCH, which also occurs if the leading dir does not exist.
This fixes OE's do_rootfs from failing without an error message.
git-svn-id: http://opkg.googlecode.com/svn/trunk@498 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r-- | libopkg/opkg_conf.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c index a29666c..d0d0329 100644 --- a/libopkg/opkg_conf.c +++ b/libopkg/opkg_conf.c @@ -392,10 +392,21 @@ 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; glob_t globbuf; @@ -436,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; |