summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2005-03-28 15:33:44 +0000
committerJason Woodward2005-03-28 15:33:44 +0000
commit5ce77950992c0df844d9892a1cb413557999d3aa (patch)
tree9d9bfac073f986bc0c32175db4b9c12480f12770 /src
parent8ffe7b89652fd774cf3a5581878ae048e5559a83 (diff)
downloadslapt-get-5ce77950992c0df844d9892a1cb413557999d3aa.tar.gz
fixed ignoring suggestion when there was only one suggestion
Diffstat (limited to 'src')
-rw-r--r--src/transaction.c21
1 files changed, 13 insertions, 8 deletions
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 ){