[PATCH] partx: do not add nonexistent partitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This simple patch fixes partx -a to not add nonexistent zero length
partitions for unused primary partition slots to to the kernel.  This
makes partx conform to the usual kernel behavior.

--- util-linux-2.16.orig/partx/partx.c
+++ util-linux-2.16/partx/partx.c
@@ -296,6 +296,9 @@
                }
                }
                for (j=0; j<n; j++) {
+               // skip unused/empty partitions
+               if( slices[j].size == 0 )
+                 continue;
                pt.pno = lower+j;
                pt.start = 512 * (long long) slices[j].start;
                pt.length = 512 * (long long) slices[j].size;
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux