diff options
author | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-11-12 20:23:20 (EST) |
---|---|---|
committer | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-11-12 20:23:20 (EST) |
commit | 1052b2193d46d5c1251eb0e9285555f868ba543b (patch) | |
tree | d5367436b9877c39fbdeaf09c5c093a8cbbef770 | |
parent | f502667e06364b16c7d06dcdf0df3d21e61140dd (diff) |
Make opkg_conf_parse_file() return -1 for error, as expected where it is called.
git-svn-id: http://opkg.googlecode.com/svn/trunk@295 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r-- | libopkg/opkg_conf.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c index 8b10260..47e11ec 100644 --- a/libopkg/opkg_conf.c +++ b/libopkg/opkg_conf.c @@ -505,18 +505,19 @@ static int opkg_conf_parse_file(opkg_conf_t *conf, const char *filename, { int err; opkg_option_t * options; - FILE *file = fopen(filename, "r"); + FILE *file; regex_t valid_line_re, comment_re; #define regmatch_size 12 regmatch_t regmatch[regmatch_size]; opkg_init_options_array(conf, &options); + file = fopen(filename, "r"); if (file == NULL) { fprintf(stderr, "%s: failed to open %s: %s\n", __FUNCTION__, filename, strerror(errno)); free(options); - return errno; + return -1; } opkg_message(conf, OPKG_NOTICE, "loading conf file %s\n", filename); @@ -525,12 +526,12 @@ static int opkg_conf_parse_file(opkg_conf_t *conf, const char *filename, REG_EXTENDED); if (err) { free(options); - return err; + return -1; } err = xregcomp(&valid_line_re, "^[[:space:]]*(\"([^\"]*)\"|([^[:space:]]*))[[:space:]]*(\"([^\"]*)\"|([^[:space:]]*))[[:space:]]*(\"([^\"]*)\"|([^[:space:]]*))([[:space:]]+([^[:space:]]+))?[[:space:]]*$", REG_EXTENDED); if (err) { free(options); - return err; + return -1; } while(1) { @@ -622,7 +623,7 @@ static int opkg_conf_parse_file(opkg_conf_t *conf, const char *filename, fprintf(stderr, "WARNING: Ignoring unknown configuration " "parameter: %s %s %s\n", type, name, value); free(options); - return EINVAL; + return -1; } free(type); |