OpenSDE Packages Database (without history before r20070)
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.

61 lines
1.7 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../mdadm/mdadm-3.2.2-version.patch
  5. # Copyright (C) 2011 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. From f161d047eed634b3380262767f955eb888502e88 Mon Sep 17 00:00:00 2001
  17. From: NeilBrown <neilb@suse.de>
  18. Date: Fri, 17 Jun 2011 22:49:24 +1000
  19. Subject: [PATCH 1/1] util: correctly parse shorter linux version numbers.
  20. The next version of Linux might be 3.0. If it is, get_linux_version
  21. will fail.
  22. So make it more robust.
  23. Reported-by: Namhyung Kim <namhyung@gmail.com>
  24. Reported-by: Milan Broz <mbroz@redhat.com>
  25. Signed-off-by: NeilBrown <neilb@suse.de>
  26. ---
  27. util.c | 10 +++++-----
  28. 1 files changed, 5 insertions(+), 5 deletions(-)
  29. diff --git a/util.c b/util.c
  30. index 10bbe56..55d171a 100644
  31. --- a/util.c
  32. +++ b/util.c
  33. @@ -146,16 +146,16 @@ int get_linux_version()
  34. {
  35. struct utsname name;
  36. char *cp;
  37. - int a,b,c;
  38. + int a = 0, b = 0,c = 0;
  39. if (uname(&name) <0)
  40. return -1;
  41. cp = name.release;
  42. a = strtoul(cp, &cp, 10);
  43. - if (*cp != '.') return -1;
  44. - b = strtoul(cp+1, &cp, 10);
  45. - if (*cp != '.') return -1;
  46. - c = strtoul(cp+1, NULL, 10);
  47. + if (*cp == '.')
  48. + b = strtoul(cp+1, &cp, 10);
  49. + if (*cp == '.')
  50. + c = strtoul(cp+1, &cp, 10);
  51. return (a*1000000)+(b*1000)+c;
  52. }
  53. --
  54. 1.7.6.3