You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.7 KiB
62 lines
1.7 KiB
13 years ago
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
||
|
#
|
||
|
# Filename: package/.../mdadm/mdadm-3.2.2-version.patch
|
||
|
# Copyright (C) 2011 The OpenSDE Project
|
||
|
#
|
||
|
# More information can be found in the files COPYING and README.
|
||
|
#
|
||
|
# This patch file is dual-licensed. It is available under the license the
|
||
|
# patched project is licensed under, as long as it is an OpenSource license
|
||
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
||
|
# of the GNU General Public License as published by the Free Software
|
||
|
# Foundation; either version 2 of the License, or (at your option) any later
|
||
|
# version.
|
||
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
||
|
|
||
|
From f161d047eed634b3380262767f955eb888502e88 Mon Sep 17 00:00:00 2001
|
||
|
From: NeilBrown <neilb@suse.de>
|
||
|
Date: Fri, 17 Jun 2011 22:49:24 +1000
|
||
|
Subject: [PATCH 1/1] util: correctly parse shorter linux version numbers.
|
||
|
|
||
|
The next version of Linux might be 3.0. If it is, get_linux_version
|
||
|
will fail.
|
||
|
So make it more robust.
|
||
|
|
||
|
Reported-by: Namhyung Kim <namhyung@gmail.com>
|
||
|
Reported-by: Milan Broz <mbroz@redhat.com>
|
||
|
Signed-off-by: NeilBrown <neilb@suse.de>
|
||
|
---
|
||
|
util.c | 10 +++++-----
|
||
|
1 files changed, 5 insertions(+), 5 deletions(-)
|
||
|
|
||
|
diff --git a/util.c b/util.c
|
||
|
index 10bbe56..55d171a 100644
|
||
|
--- a/util.c
|
||
|
+++ b/util.c
|
||
|
@@ -146,16 +146,16 @@ int get_linux_version()
|
||
|
{
|
||
|
struct utsname name;
|
||
|
char *cp;
|
||
|
- int a,b,c;
|
||
|
+ int a = 0, b = 0,c = 0;
|
||
|
if (uname(&name) <0)
|
||
|
return -1;
|
||
|
|
||
|
cp = name.release;
|
||
|
a = strtoul(cp, &cp, 10);
|
||
|
- if (*cp != '.') return -1;
|
||
|
- b = strtoul(cp+1, &cp, 10);
|
||
|
- if (*cp != '.') return -1;
|
||
|
- c = strtoul(cp+1, NULL, 10);
|
||
|
+ if (*cp == '.')
|
||
|
+ b = strtoul(cp+1, &cp, 10);
|
||
|
+ if (*cp == '.')
|
||
|
+ c = strtoul(cp+1, &cp, 10);
|
||
|
|
||
|
return (a*1000000)+(b*1000)+c;
|
||
|
}
|
||
|
--
|
||
|
1.7.6.3
|
||
|
|