File libparted-dasd-add-an-exception-for-changing-DASD-LD.patch of Package parted.15765

From ee2c0c20fb215af43b12195e8cd645cc1a0bd96e Mon Sep 17 00:00:00 2001
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
Date: Fri, 24 Mar 2017 11:20:09 +0100
Subject: [PATCH] libparted/dasd: add an exception for changing DASD-LDL
 partition table

The partition table of DASD-LDL device with the dasd disk label
should not be changed according to its character in Linux.
When the user tries to modify the partition table, an exception
will be raised to inform user of this character.

Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
---
 libparted/labels/dasd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Index: parted-3.2/libparted/labels/dasd.c
===================================================================
--- parted-3.2.orig/libparted/labels/dasd.c
+++ parted-3.2/libparted/labels/dasd.c
@@ -617,8 +617,12 @@ dasd_write (const PedDisk* disk)
 	PDEBUG;
 
 	/* If not formated in CDL, don't write anything. */
-	if (disk_specific->format_type == 1)
+	if (disk_specific->format_type == 1) {
+		ped_exception_throw (PED_EXCEPTION_ERROR,
+				     PED_EXCEPTION_CANCEL,
+				     _("The partition table of DASD-LDL device cannot be changed.\n"));
 		return 1;
+	}
 
 	/* Ensure the device is open RW */
 	char dummy[10]; /* to avoid assertion in ped_device_write */
openSUSE Build Service is sponsored by