From 1052b2193d46d5c1251eb0e9285555f868ba543b Mon Sep 17 00:00:00 2001 From: "graham.gower" Date: Fri, 13 Nov 2009 01:23:20 +0000 Subject: [PATCH] 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 --- libopkg/opkg_conf.c | 11 ++++++----- 1 file 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); -- 2.25.1