Re: [PATCH] losetup: canonicalize loopfile name

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

 



On Tue, Sep 11, 2007 at 02:35:33PM +0200, Matthias Koenig wrote:

> -	xstrncpy(loopinfo64.lo_file_name, file, LO_NAME_SIZE);
> + 	myrealpath(file, res_file, PATH_MAX);
> + 	xstrncpy(loopinfo64.lo_file_name, res_file, LO_NAME_SIZE);

 The LO_NAME_SIZE is terribly small (64 bytes). Matthias, what do you
 think about:

 -       xstrncpy(loopinfo64.lo_file_name, file, LO_NAME_SIZE);
 +       lo_filename = filename = canonicalize(file);
 +       if (strlen(filename) > LO_NAME_SIZE)
 +               lo_filename = basename(filename);
 +       xstrncpy(loopinfo64.lo_file_name, lo_filename, LO_NAME_SIZE);


 plus relevant description to losetup and mount man pages.

 (Well, in the final patch we should call the canonicalize(file)
 outside set_loop(), because mount(8) code is already using
 canonicalized paths. That's detail (for now...))


 I'd like to a little clean up mount/* code, because now there is more
 than one version of error(), ...etc. So please, be patient with your
 lomount patches. I'll inform you...

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
-
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