Re: [PATCH 1/2] btrfs-progs: multidevice support for check_mounted

Karel Zak
2009-11-21T20:21:10Z

On Sat, Nov 21, 2009 at 03:38:38PM +0100, Andi Drebes wrote:
> +
> +/* Checks if an mntentry represents a pseudo FS */
> +int is_pseudo_fs(const struct mntent* mnt)
> +{
> + struct stat st_buf;
> +
> + if(stat(mnt->mnt_fsname, &st_buf) < 0) {
> + if(errno == ENOENT)
> + return 1;
> + else
> + return -errno;
> + }
> +
> + return 0;
> +}

This is bad idea. The mnt_fsname field could be an arbitrary string
include valid paths.

# grep sysfs /proc/mounts
/sys /sys sysfs rw,relatime 0 0

Karel

--
Karel Zak <kzak@redhat.com>