aboutsummaryrefslogtreecommitdiffstats
path: root/src/package.c
diff options
context:
space:
mode:
authorJason Woodward2009-04-29 04:18:24 +0000
committerJason Woodward2009-04-29 04:18:24 +0000
commitb391cd94c46dd87aa4e63ed8d1aa8111365b8223 (patch)
treebea4861e9ed8368c399054d01a411e0e4573d18f /src/package.c
parente03a2f82c9091f968acefb3737ab1b0827bd8de7 (diff)
downloadslapt-get-b391cd94c46dd87aa4e63ed8d1aa8111365b8223.tar.gz
updated MD5 parsing to accept new slackware MD5SUM metadata in /var/log/packages entries
Diffstat (limited to 'src/package.c')
-rw-r--r--src/package.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/package.c b/src/package.c
index 5ebe3a2..76f63db 100644
--- a/src/package.c
+++ b/src/package.c
@@ -352,11 +352,14 @@ struct slapt_pkg_list *slapt_parse_packages_txt(FILE *pkg_list_fh)
if (
((bytes_read = getline(&getline_buffer,&getline_len,
pkg_list_fh)) != EOF) &&
- (strstr(getline_buffer,"PACKAGE MD5 SUM") != NULL)
+ (strstr(getline_buffer,"PACKAGE MD5") != NULL)
) {
char *md5sum;
getline_buffer[bytes_read - 1] = '\0';
- md5sum = (char *)strpbrk(getline_buffer,":") + 3;
+ md5sum = (char *)strpbrk(getline_buffer,":") + 1;
+ while (*md5sum != 0 && isspace(*md5sum)) {
+ md5sum++;
+ }
/* don't overflow the buffer */
if (strlen(md5sum) > SLAPT_MD5_STR_LEN) {
fprintf(stderr, gettext("md5 sum too long\n"));
@@ -1263,7 +1266,7 @@ void slapt_write_pkg_data(const char *source_url,FILE *d_file,
fprintf(d_file,"PACKAGE REQUIRED: %s\n",pkgs->pkgs[i]->required);
fprintf(d_file,"PACKAGE CONFLICTS: %s\n",pkgs->pkgs[i]->conflicts);
fprintf(d_file,"PACKAGE SUGGESTS: %s\n",pkgs->pkgs[i]->suggests);
- fprintf(d_file,"PACKAGE MD5 SUM: %s\n",pkgs->pkgs[i]->md5);
+ fprintf(d_file,"PACKAGE MD5SUM: %s\n",pkgs->pkgs[i]->md5);
fprintf(d_file,"PACKAGE DESCRIPTION:\n");
/* do we have to make up an empty description? */
if (strlen(pkgs->pkgs[i]->description) < strlen(pkgs->pkgs[i]->name)) {