~ubuntu-branches/ubuntu/lucid/lvm2/lucid-security

« back to all changes in this revision

Viewing changes to debian/patches/avoid-dev-block.patch

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2009-04-08 14:19:32 UTC
  • Revision ID: james.westby@ubuntu.com-20090408141932-6sq7m7fy20anlno4
Tags: 2.02.39-0ubuntu9
debian/patches/avoid-dev-block.patch: Prefer any other device name over
names in /dev/block/ (LP: #341928).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Index: b/lib/device/dev-cache.c
 
2
===================================================================
 
3
--- a/lib/device/dev-cache.c
 
4
+++ b/lib/device/dev-cache.c
 
5
@@ -177,6 +177,21 @@
 
6
         * Built-in rules.
 
7
         */
 
8
 
 
9
+       /* Put /dev/block/ names last regardless of path shortness.
 
10
+        * FIXME It would be better if we could do this in the configuration
 
11
+        * file, but the only way to do so with preferred_names is to try to
 
12
+        * enumerate all the possible names we might want to prefer over
 
13
+        * /dev/block/. */
 
14
+       m0 = strncmp(path0, "/dev/block/", 11);
 
15
+       m1 = strncmp(path1, "/dev/block/", 11);
 
16
+
 
17
+       if (m0 != m1) {
 
18
+               if (m0 == 0)
 
19
+                       return 1;
 
20
+               if (m1 == 0)
 
21
+                       return 0;
 
22
+       }
 
23
+
 
24
        /* Return the path with fewer slashes */
 
25
        for (p = path0; p++; p = (const char *) strchr(p, '/'))
 
26
                slash0++;