diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/transaction.c | 21 |
2 files changed, 14 insertions, 8 deletions
@@ -1,5 +1,6 @@ 0.9.9j Mar 28, 2005 + * fixed ignoring suggestion when there was only one suggestion * added copy_pkg() to package.[ch] instead of using memcpy() in the transaction code, so free_transaction() calls free_pkg() making all usage of pkg_info_t objects uniform diff --git a/src/transaction.c b/src/transaction.c index 583f088..074080c 100644 --- a/src/transaction.c +++ b/src/transaction.c @@ -668,16 +668,21 @@ static void add_suggestion(transaction_t *tran, pkg_info_t *pkg){ if( p == NULL ) break; si = strpbrk(p," ,"); - if( si == NULL || strlen(si) <= 2 ) break; - si = si + 1; + if( si == NULL || strlen(si) <= 2 ){ + total_len = strlen(p); + rest_len = 0; + tmp_suggests = strndup(p,strlen(p)); + }else{ + si = si + 1; - total_len = strlen(p); - rest_len = strlen(si); + total_len = strlen(p); + rest_len = strlen(si); - /* this will always encompass ending space, so we dont + 1 */ - tmp_suggests = slapt_malloc(sizeof *tmp_suggests * (total_len - rest_len) ); - tmp_suggests = strncpy(tmp_suggests,p,(total_len - rest_len)); - tmp_suggests[total_len - rest_len - 1] = '\0'; + /* this will always encompass ending space, so we dont + 1 */ + tmp_suggests = slapt_malloc(sizeof *tmp_suggests * (total_len - rest_len) ); + tmp_suggests = strncpy(tmp_suggests,p,(total_len - rest_len)); + tmp_suggests[total_len - rest_len - 1] = '\0'; + } /* no need to add it if we already have it */ if( search_transaction(tran,tmp_suggests) == 1 ){ |