[parted-devel] Problem with Linux "3.0"

Jim Meyering jim at meyering.net
Tue Jun 7 06:22:04 UTC 2011


Richard W.M. Jones wrote:
> Jim, I tested your patch and it fixes the problem.

Thanks, Rich.
I've pushed this:

>From bb4fbe2130cd85727bbaf6c71b2d27b6769aa4aa Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Sun, 5 Jun 2011 18:15:31 +0200
Subject: [PATCH] libparted: accommodate two-component linux version number
 like 3.0

* libparted/arch/linux.c (_get_linux_version): Also accept 2-component
version numbers.
* NEWS: (Bug fixes): Mention it.
Reported by Richard W.M. Jones.
---
 NEWS                   |    4 ++++
 libparted/arch/linux.c |    6 +++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index 1e48897..790b303 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ GNU parted NEWS                                    -*- outline -*-

 * Noteworthy changes in release ?.? (????-??-??) [?]

+** Bug fixes
+
+  libparted: works with a two-component linux kernel version number like 3.0
+

 * Noteworthy changes in release 3.0 (2011-05-30) [stable]

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index aeaf98f..111816c 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -610,7 +610,11 @@ _get_linux_version ()

         if (uname (&uts))
                 return kver = 0;
-        if (sscanf (uts.release, "%u.%u.%u", &major, &minor, &teeny) != 3)
+        if (sscanf (uts.release, "%u.%u.%u", &major, &minor, &teeny) == 3)
+                ; /* ok */
+        else if (sscanf (uts.release, "%u.%u", &major, &minor) == 2)
+                teeny = 0;
+        else
                 return kver = 0;

         return kver = KERNEL_VERSION (major, minor, teeny);
--
1.7.6.rc0.254.gf37de



More information about the parted-devel mailing list