[lvm2] Accept kernel 3.0 uname string in libdevmapper initialization.

Milan Broz mbroz at fedoraproject.org
Sat Jun 4 19:24:37 UTC 2011


commit d47b2bc3793a6df2d656105dbb1a561608870b73
Author: Milan Broz <mbroz at fedoraproject.org>
Date:   Sat Jun 4 21:23:37 2011 +0200

    Accept kernel 3.0 uname string in libdevmapper initialization.

 lvm2-uname.patch |   32 ++++++++++++++++++++++++++++++++
 lvm2.spec        |    7 ++++++-
 2 files changed, 38 insertions(+), 1 deletions(-)
---
diff --git a/lvm2-uname.patch b/lvm2-uname.patch
new file mode 100644
index 0000000..856acd7
--- /dev/null
+++ b/lvm2-uname.patch
@@ -0,0 +1,32 @@
+--- a/libdm/ioctl/libdm-iface.c
++++ b/libdm/ioctl/libdm-iface.c
+@@ -152,6 +152,7 @@ static int _uname(void)
+ {
+ 	static int _uts_set = 0;
+ 	struct utsname _uts;
++	int parts;
+ 
+ 	if (_uts_set)
+ 		return 1;
+@@ -160,10 +161,18 @@ static int _uname(void)
+ 		log_error("uname failed: %s", strerror(errno));
+ 		return 0;
+ 	}
+-	if (sscanf(_uts.release, "%d.%d.%d",
++
++	parts = sscanf(_uts.release, "%d.%d.%d",
+ 			&_kernel_major,
+ 			&_kernel_minor,
+-			&_kernel_release) != 3) {
++			&_kernel_release);
++
++	if (parts == 1 && _kernel_major >= 3) {
++		_kernel_minor = 0;
++		_kernel_release = 0;
++	} else if (parts == 2 && _kernel_major >= 3) {
++		_kernel_release = 0;
++	} else if (parts != 3) {
+ 		log_error("Could not determine kernel version used.");
+ 		return 0;
+ 	}
+
diff --git a/lvm2.spec b/lvm2.spec
index 5d1320c..2ce3dfb 100644
--- a/lvm2.spec
+++ b/lvm2.spec
@@ -30,13 +30,14 @@
 Summary: Userland logical volume management tools 
 Name: lvm2
 Version: 2.02.84
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv2
 Group: System Environment/Base
 URL: http://sources.redhat.com/lvm2
 Source0: ftp://sources.redhat.com/pub/lvm2/LVM2.%{version}.tgz
 Source1: %{name}-tmpfiles.conf
 Patch0: lvm2-set-default-preferred_names.patch
+Patch1: lvm2-uname.patch
 
 BuildRequires: libselinux-devel >= 1.30.19-4, libsepol-devel
 BuildRequires: ncurses-devel
@@ -68,6 +69,7 @@ or more physical volumes and creating one or more logical volumes
 %prep
 %setup -q -n LVM2.%{version}
 %patch0 -p1 -b preferred_names
+%patch1 -p1 -b .uname
 
 %build
 %define _exec_prefix ""
@@ -475,6 +477,9 @@ the device-mapper event library.
 
 
 %changelog
+* Sat Jun 4 2011 Milan Broz <mbroz at redhat.com> - 2.02.84-2
+- Accept kernel 3.0 uname string in libdevmapper initialization.
+
 * Wed Feb 9 2011 Alasdair Kergon <agk at redhat.com> - 2.02.84-1
 - Fix big-endian CRC32 checksumming broken since 2.02.75.  If affected,
   ensure metadata backups in /etc/lvm/backup are up-to-date (vgcfgbackup)


More information about the scm-commits mailing list