diff options
author | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-11-12 00:02:46 (EST) |
---|---|---|
committer | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-11-12 00:02:46 (EST) |
commit | 7be28022d09b3a4923db82bae66187ceafa5a53c (patch) | |
tree | a20bcd206eb664e8929808b7193d352215ba8b3e /libopkg/pkg_parse.c | |
parent | 332947f2518b71342ebe3719899e83405a79c15d (diff) |
Fix parsing of Conffiles lines in status files.
Also, add a leading space when writing out the status file such that the
parser can recognise these lines as conf file lines.
git-svn-id: http://opkg.googlecode.com/svn/trunk@287 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/pkg_parse.c')
-rw-r--r-- | libopkg/pkg_parse.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/libopkg/pkg_parse.c b/libopkg/pkg_parse.c index a8aa231..4f7fcf2 100644 --- a/libopkg/pkg_parse.c +++ b/libopkg/pkg_parse.c @@ -82,26 +82,19 @@ static char ** parseDependsString(const char * raw, int * depends_count) return depends; } -static void parseConffiles(pkg_t * pkg, const char * raw) +static void +parseConffiles(pkg_t *pkg, const char *cstr) { - char file_name[1048], md5sum[1048]; /* please tell me there aren't any longer that 1k */ + char file_name[1024], md5sum[35]; - if(!strncmp(raw, "Conffiles:", 10)) - raw += strlen("Conffiles:"); + if (sscanf(cstr, "%1023s %34s", file_name, md5sum) != 2) { + fprintf(stderr, "%s: failed to parse Conffiles line for %s\n", + __FUNCTION__, pkg->name); + return; + } - while(*raw && (sscanf(raw, "%s%s", file_name, md5sum) == 2)){ conffile_list_append(&pkg->conffiles, file_name, md5sum); - /* fprintf(stderr, "%s %s ", file_name, md5sum);*/ - while (*raw && isspace(*raw)) { - raw++; - } - raw += strlen(file_name); - while (*raw && isspace(*raw)) { - raw++; - } - raw += strlen(md5sum); - } -} +} int parseVersion(pkg_t *pkg, const char *vstr) @@ -158,7 +151,6 @@ pkg_parse_line(pkg_t *pkg, const char *line, uint mask) case 'C': if((mask & PFM_CONFFILES) && isGenericFieldType("Conffiles", line)){ - parseConffiles(pkg, line); reading_conffiles = 1; reading_description = 0; goto dont_reset_flags; |