find_root_device: use lstat - don't follow links
diff --git a/libbb/find_root_device.c b/libbb/find_root_device.c
index 7182102..9779f7e 100644
--- a/libbb/find_root_device.c
+++ b/libbb/find_root_device.c
@@ -41,7 +41,8 @@
while ((entry = readdir(dir)) != NULL) {
safe_strncpy(ap->devpath + len, entry->d_name, rem);
- if (stat(ap->devpath, &ap->st) != 0)
+ /* lstat: do not follow links */
+ if (lstat(ap->devpath, &ap->st) != 0)
continue;
if (S_ISBLK(ap->st.st_mode) && ap->st.st_rdev == ap->dev) {
retpath = xstrdup(ap->devpath);