Re: [PATCH] mount: Automagically detect and loop-mount regular files.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

On Fri, 2010-01-08 at 16:40:51 -0500, Adam Jackson wrote:
> Signed-off-by: Adam Jackson <ajax@xxxxxxxxxx>
> ---
>  mount/mount.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/mount/mount.c b/mount/mount.c
> index 0cef101..054ea9a 100644
> --- a/mount/mount.c
> +++ b/mount/mount.c
> @@ -1075,6 +1075,12 @@ loop_check(const char **spec, const char **type, int *flags,
>    *loop = ((*flags & MS_LOOP) || *loopdev || opt_offset || opt_sizelimit || opt_encryption);
>    *loopfile = *spec;
>  
> +  if (!*loop) {
> +    struct stat st_buf;
> +    stat(*spec, &st_buf);
> +    *loop = S_ISREG(st_buf.st_mode);

Shouldn't you check if stat was successful before using st_buf?

> +  }
> +
>    if (*loop) {
>      *flags |= MS_LOOP;
>      if (fake) {

regards,
guillem
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux