~adam-stokes/ubuntu/quantal/nfs-utils/hang-on-kernel-expire-794112

« back to all changes in this revision

Viewing changes to debian/patches/ubuntu-fix-kernel-version-handling

  • Committer: Steve Langasek
  • Date: 2011-10-29 21:56:45 UTC
  • mfrom: (14.1.15 sid)
  • Revision ID: steve.langasek@canonical.com-20111029215645-ohwji14mw3tamz84
Merge Debian version 1:1.2.5-2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: trunk/utils/mount/version.h
2
 
===================================================================
3
 
--- trunk.orig/utils/mount/version.h
4
 
+++ trunk/utils/mount/version.h
5
 
@@ -37,14 +37,23 @@
6
 
 static inline unsigned int linux_version_code(void)
7
 
 {
8
 
        struct utsname my_utsname;
9
 
-       unsigned int p, q, r;
10
 
+       unsigned int p = 0, q = 0, r = 0;
11
 
+       char *t;
12
 
 
13
 
        if (uname(&my_utsname))
14
 
                return 0;
15
 
 
16
 
-       p = (unsigned int)atoi(strtok(my_utsname.release, "."));
17
 
-       q = (unsigned int)atoi(strtok(NULL, "."));
18
 
-       r = (unsigned int)atoi(strtok(NULL, "."));
19
 
+       t = strtok(my_utsname.release, ".");
20
 
+       if (t) {
21
 
+               p = (unsigned int)atoi(t);
22
 
+               t = strtok(NULL, ".");
23
 
+               if (t) {
24
 
+                       q = (unsigned int)atoi(t);
25
 
+                       t = strtok(NULL, ".");
26
 
+                       if (t)
27
 
+                               r = (unsigned int)atoi(t);
28
 
+               }
29
 
+       }
30
 
        return MAKE_VERSION(p, q, r);
31
 
 }
32