On Sun, Nov 22, 2009 at 02:33:13PM +0100, Andi Drebes wrote:
> In the new patch below, is_pseudo_fs() is replaced by
> is_existing_blk_or_reg_file(). We ignore entries associated with an
> invalid path or paths that don't point to a regular or block file.
> However, if a path used in a pseudo-filesystem entry points to the
> file that is being checked, check_mounted() returns 1. In my eyes,
> this is extremely unlikely.
...
> +/* Checks if a file exists and is a block or regular file*/
> +int is_existing_blk_or_reg_file(const char* filename)
> +{
> +     struct stat st_buf;
> +
> +     if(stat(filename, &st_buf) < 0) {
> +             if(errno == ENOENT)
> +                     return 0;
> +             else
> +                     return -errno;
> +     }
> +
> +     return (S_ISBLK(st_buf.st_mode) || S_ISREG(st_buf.st_mode));
> +}

 Yes, this looks better.

    Karel

-- 
 Karel Zak  <k...@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to