mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-11 22:04:37 +08:00
26 lines
803 B
Diff
26 lines
803 B
Diff
--- util/getroot.c~ 2010-07-12 20:34:58.498317508 +0200
|
|
+++ util/getroot.c 2010-07-12 20:34:58.556288678 +0200
|
|
@@ -222,9 +222,20 @@
|
|
/* 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))
|
|
{
|