blob: aead475c41500eb2e82aacd7e5015f4ca4f92830 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
--- a/util/getroot.c 2010-03-06 20:51:37.000000000 +0000
+++ b/util/getroot.c 2010-05-28 19:21:57.592307313 +0100
@@ -222,9 +222,20 @@ find_root_device (const char *dir, dev_t
/* Ignore any error. */
continue;
- if (S_ISLNK (st.st_mode))
- /* Don't follow symbolic links. */
+ if (S_ISLNK (st.st_mode)) {
+#ifdef __linux__
+ if (strcmp (dir, "mapper") == 0) {
+ /* Follow symbolic links under /dev/mapper/; the canonical name
+ may be something like /dev/dm-0, but the names under
+ /dev/mapper/ are more human-readable and so we prefer them if
+ we can get them. */
+ if (stat (ent->d_name, &st) < 0)
+ continue;
+ } else
+#endif /* __linux__ */
+ /* Don't follow other symbolic links. */
continue;
+ }
if (S_ISDIR (st.st_mode))
{
|