parted/parted-3.0-libparted-accommodate-two-component-linux-version-nu.patch

36 lines
1.1 KiB
Diff
Raw Normal View History

From bb4fbe2130cd85727bbaf6c71b2d27b6769aa4aa Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@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/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.5.2