From 44eb4ca0b22616745818187dd5e69ba3d6482aa6 Mon Sep 17 00:00:00 2001 From: vda Date: Sat, 21 Apr 2007 23:28:03 +0000 Subject: find_root_device: use lstat - don't follow links git-svn-id: svn://busybox.net/trunk/busybox@18513 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- libbb/find_root_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) 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); -- cgit v1.2.3-55-g6feb