Re: [PATCH] losetup: canonicalize loopfile name

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

 



On Mon, Sep 24, 2007 at 06:43:31PM +0200, Matthias Koenig wrote:
> Karel Zak <kzak@xxxxxxxxxx> writes:
> 
> > 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). 
> 
> Too bad.

 Time for kernel patch? :-)

> >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);
> >
> 
> Hmm, I don't like the two convention approach, using full path and
> basename mixed.

 Yes, I agree.

> What about truncating the name in the middle and adding a continuation
> marker if it is too long? Like:
> "/path/to/very_very_long_name" --> "/path/to...name"

 I've talked about it with my co-workers and another idea:

   "/path/to/very_very_long_name" -->   "...to/very_very_long_name"

 it means end of path.

    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