File libparted-sync-partitions-gt-16.patch of Package parted.30108

From: Phillip Susi <psusi@ubuntu.com>
Date: Mon, 23 Dec 2013 15:28:22 -0500
Subject: libparted: sync partitions > 16
References: bsc#501773, bsc#1092327
Patch-mainline: v3.2
Git-commit: 026736e9fed89ef00e6e6e84c7e422639ac2715c

The linux partition sync code was hard coded to only flush
the first 16 partitions.

Acked-by: Sebastian Parschauer <sparschauer@suse.de>
---
 libparted/arch/linux.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -289,6 +289,8 @@ struct blkdev_ioctl_param {
 
 static char* _device_get_part_path (PedDevice const *dev, int num);
 static int _partition_is_mounted_by_path (const char* path);
+static unsigned int _device_get_partition_range(PedDevice const* dev);
+
 
 static int
 _read_fd (int fd, char **buf)
@@ -1581,6 +1583,7 @@ _flush_cache (PedDevice* dev)
 {
         LinuxSpecific*  arch_specific = LINUX_SPECIFIC (dev);
         int             i;
+	int             lpn = _device_get_partition_range(dev);
 
         if (dev->read_only)
                 return;
@@ -1588,7 +1591,7 @@ _flush_cache (PedDevice* dev)
 
         ioctl (arch_specific->fd, BLKFLSBUF);
 
-        for (i = 1; i < 16; i++) {
+        for (i = 1; i < lpn; i++) {
                 char*           name;
                 int             fd;
 
openSUSE Build Service is sponsored by