The following commit has been merged in the master branch:
commit 37fe6b4a5ccf58ed553fe24ba19535b6d1bf92ba
Author: Raphaël Hertzog <[email protected]>
Date:   Fri Jul 23 08:06:36 2010 +0200

    update-alternatives: avoid segfault when the only slave is disappearing
    
    When an alternative with a single slave is removed, and when the
    remaining alternatives have no slaves, u-a was segfaulting while trying
    to remove the slave alternative from the structure.
    
    Reported-by: Jonathan Nieder <[email protected]>
    Reported-by: Cyril Brulebois <[email protected]>

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 972d173..0f6487a 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -1236,6 +1236,8 @@ alternative_save(struct alternative *a, const char *file)
                        sl_rm = sl;
                        sl = sl_prev ? sl_prev : a->slaves;
                        slave_link_free(sl_rm);
+                       if (!sl)
+                               break; /* no other slave left */
                }
        }
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to