util-linux/mount.c : lstat / stat ?
Denis Vlasenko
vda.linux at googlemail.com
Fri May 18 00:00:44 UTC 2007
On Thursday 17 May 2007 12:05, Yann Le Doaré wrote:
> Hi,
>
> I had to replace lstat with stat in util-linux/mount.c (Busybox 1.4.2)
> to make mount works with symbolics links.
Can you elaborate a bit more. I see only one lstat(), here:
// Look at the file. (Not found isn't a failure for remount, or for
// a synthetic filesystem like proc or sysfs.)
if (!lstat(mp->mnt_fsname, &st)
&& !(vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE))
) {
// Do we need to allocate a loopback device for it?
if (ENABLE_FEATURE_MOUNT_LOOP && S_ISREG(st.st_mode)) {
loopFile = bb_simplify_path(mp->mnt_fsname);
mp->mnt_fsname = 0;
switch (set_loop(&(mp->mnt_fsname), loopFile, 0)) {
case 0:
case 1:
break;
default:
bb_error_msg( errno == EPERM || errno == EACCES
? bb_msg_perm_denied_are_you_root
: "cannot setup loop device");
return errno;
}
// Autodetect bind mounts
} else if (S_ISDIR(st.st_mode) && !mp->mnt_type)
vfsflags |= MS_BIND;
}
> (The patch svn-15788.patch was used to fix it in busybox 1.2.1)
adding/removing/adding of fixes happens when some not obvious
code lacks good comment. In this piece of code, for example,
I wouldn't see immediately whether we need stat or lstat.
--
vda
More information about the busybox
mailing list