}
-/*
- *-----------------------------------------------------------------------------
- *
- * ShrinkGetPartition --
- *
- * Finds the WiperPartion whose mountpoint is given.
- *
- * Results:
- * The WiperPatition.
- *
- * Side effects:
- * None
- *
- *-----------------------------------------------------------------------------
- */
-
-static WiperPartition*
-ShrinkGetPartition(char *mountPoint)
-{
- WiperPartition_List plist;
- WiperPartition *p, *part = NULL;
- DblLnkLst_Links *curr;
-
- if (!ShrinkGetMountPoints(&plist)) {
- return NULL;
- }
-
- DblLnkLst_ForEach(curr, &plist.link) {
- p = DblLnkLst_Container(curr, WiperPartition, link);
- if (toolbox_strcmp(p->mountPoint, mountPoint) == 0) {
- part = p;
- /*
- * Detach the element we are interested in so it is not
- * destroyed when we call WiperPartition_Close.
- */
- DblLnkLst_Unlink1(&part->link);
- break;
- }
- }
-
- WiperPartition_Close(&plist);
-
- return part;
-}
-
-
/*
*-----------------------------------------------------------------------------
*
int i;
int progress = 0;
unsigned char *err;
- WiperPartition *part;
+ WiperPartition *part = NULL;
+ WiperPartition_List plist;
int rc;
#if defined(_WIN32)
signal(SIGINT, ShrinkWiperDestroy);
#endif
- part = ShrinkGetPartition(mountPoint);
+ if (ShrinkGetMountPoints(&plist)) {
+ DblLnkLst_Links *curr, *nextElem;
+ DblLnkLst_ForEachSafe(curr, nextElem, &plist.link) {
+ WiperPartition *p = DblLnkLst_Container(curr, WiperPartition, link);
+ if (toolbox_strcmp(p->mountPoint, mountPoint) == 0) {
+ WiperSinglePartition_Close(part);
+ part = p;
+ /*
+ * Detach the element we are interested in so it is not
+ * destroyed when we call WiperPartition_Close.
+ */
+ DblLnkLst_Unlink1(&part->link);
+ if (part->type != PARTITION_UNSUPPORTED) {
+ break;
+ }
+ }
+ }
+ WiperPartition_Close(&plist);
+ }
+
if (part == NULL) {
ToolsCmd_PrintErr(SU_(disk.shrink.partition.notfound,
"Unable to find partition %s\n"),