Skip to content

Commit

Permalink
Fix backward compatibility with non-epoch builddates
Browse files Browse the repository at this point in the history
Signed-off-by: Dan McGee <[email protected]>
  • Loading branch information
toofishes committed Oct 9, 2007
1 parent 6aac221 commit 60dc4b4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/libalpm/package.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,9 +840,14 @@ static int parse_descfile(const char *descfile, pmpkg_t *info)
} else if(!strcmp(key, "license")) {
info->licenses = alpm_list_add(info->licenses, strdup(ptr));
} else if(!strcmp(key, "builddate")) {
info->builddate = atol(ptr);
} else if(!strcmp(key, "installdate")) {
info->installdate = atol(ptr);
char first = tolower(ptr[0]);
if(first > 'a' && first < 'z') {
struct tm tmp_tm = {0}; //initialize to null incase of failure
strptime(ptr, "%a %b %e %H:%M:%S %Y", &tmp_tm);
info->builddate = mktime(&tmp_tm);
} else {
info->builddate = atol(ptr);
}
} else if(!strcmp(key, "packager")) {
strncpy(info->packager, ptr, sizeof(info->packager));
} else if(!strcmp(key, "arch")) {
Expand Down

0 comments on commit 60dc4b4

Please sign in to comment.