diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-04-21 23:28:03 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-04-21 23:28:03 +0000 |
commit | 44eb4ca0b22616745818187dd5e69ba3d6482aa6 (patch) | |
tree | 5cfbd0dae75e35cb6d71af44aee2d7054b3e11c6 | |
parent | 3bb26d201b05c711d1d161941d1af8d947f69dfc (diff) | |
download | busybox-w32-44eb4ca0b22616745818187dd5e69ba3d6482aa6.tar.gz busybox-w32-44eb4ca0b22616745818187dd5e69ba3d6482aa6.tar.bz2 busybox-w32-44eb4ca0b22616745818187dd5e69ba3d6482aa6.zip |
find_root_device: use lstat - don't follow links
git-svn-id: svn://busybox.net/trunk/busybox@18513 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | libbb/find_root_device.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libbb/find_root_device.c b/libbb/find_root_device.c index 7182102c7..9779f7e82 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) | |||
41 | 41 | ||
42 | while ((entry = readdir(dir)) != NULL) { | 42 | while ((entry = readdir(dir)) != NULL) { |
43 | safe_strncpy(ap->devpath + len, entry->d_name, rem); | 43 | safe_strncpy(ap->devpath + len, entry->d_name, rem); |
44 | if (stat(ap->devpath, &ap->st) != 0) | 44 | /* lstat: do not follow links */ |
45 | if (lstat(ap->devpath, &ap->st) != 0) | ||
45 | continue; | 46 | continue; |
46 | if (S_ISBLK(ap->st.st_mode) && ap->st.st_rdev == ap->dev) { | 47 | if (S_ISBLK(ap->st.st_mode) && ap->st.st_rdev == ap->dev) { |
47 | retpath = xstrdup(ap->devpath); | 48 | retpath = xstrdup(ap->devpath); |