summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko2007-04-21 23:28:03 +0000
committerDenis Vlasenko2007-04-21 23:28:03 +0000
commit706fdc98c3d30687d1ce359f58424c87e253017c (patch)
tree5cfbd0dae75e35cb6d71af44aee2d7054b3e11c6 /libbb
parent1359da6ac7f7f44f82d224e61cc2c6ecb58baeef (diff)
downloadbusybox-706fdc98c3d30687d1ce359f58424c87e253017c.zip
busybox-706fdc98c3d30687d1ce359f58424c87e253017c.tar.gz
find_root_device: use lstat - don't follow links
Diffstat (limited to 'libbb')
-rw-r--r--libbb/find_root_device.c3
1 files changed, 2 insertions, 1 deletions
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 @@ static char *find_block_device_in_dir(struct arena *ap)
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);